mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
revert using pointers and references in cube pruning classes, instead create bitmap. Faster, at least for single threaded operation. Kinda strange
This commit is contained in:
parent
73d8dff5fe
commit
d30a10e52c
@ -202,7 +202,7 @@ public:
|
||||
class BitmapContainer
|
||||
{
|
||||
private:
|
||||
const Bitmap &m_bitmap;
|
||||
const Bitmap m_bitmap;
|
||||
HypothesisStackCubePruning &m_stack;
|
||||
HypothesisSet m_hypotheses;
|
||||
BackwardsEdgeSet m_edges;
|
||||
|
@ -288,19 +288,19 @@ HypothesisStackCubePruning::AddHypothesesToBitmapContainers()
|
||||
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) {
|
||||
Hypothesis *h = *iter;
|
||||
const Bitmap &bitmap = h->GetWordsBitmap();
|
||||
BitmapContainer *container = m_bitmapAccessor[&bitmap];
|
||||
BitmapContainer *container = m_bitmapAccessor[bitmap];
|
||||
container->AddHypothesis(h);
|
||||
}
|
||||
}
|
||||
|
||||
BitmapContainer *HypothesisStackCubePruning::AddBitmapContainer(const Bitmap &bitmap, HypothesisStackCubePruning &stack)
|
||||
{
|
||||
_BMType::iterator iter = m_bitmapAccessor.find(&bitmap);
|
||||
_BMType::iterator iter = m_bitmapAccessor.find(bitmap);
|
||||
|
||||
BitmapContainer *bmContainer;
|
||||
if (iter == m_bitmapAccessor.end()) {
|
||||
bmContainer = new BitmapContainer(bitmap, stack, m_deterministic);
|
||||
m_bitmapAccessor[&bitmap] = bmContainer;
|
||||
m_bitmapAccessor[bitmap] = bmContainer;
|
||||
} else {
|
||||
bmContainer = iter->second;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class BitmapContainer;
|
||||
class TranslationOptionList;
|
||||
class Manager;
|
||||
|
||||
typedef boost::unordered_map<const Bitmap*, BitmapContainer*, UnorderedComparer<Bitmap>, UnorderedComparer<Bitmap> > _BMType;
|
||||
typedef boost::unordered_map<Bitmap, BitmapContainer*, UnorderedComparer<Bitmap>, UnorderedComparer<Bitmap> > _BMType;
|
||||
|
||||
/** A stack for phrase-based decoding with cube-pruning. */
|
||||
class HypothesisStackCubePruning : public HypothesisStack
|
||||
|
@ -181,7 +181,7 @@ void SearchCubePruning::CreateForwardTodos(HypothesisStackCubePruning &stack)
|
||||
stack.AddHypothesesToBitmapContainers();
|
||||
|
||||
for (iterAccessor = bitmapAccessor.begin() ; iterAccessor != bitmapAccessor.end() ; ++iterAccessor) {
|
||||
const Bitmap &bitmap = *iterAccessor->first;
|
||||
const Bitmap &bitmap = iterAccessor->first;
|
||||
BitmapContainer &bitmapContainer = *iterAccessor->second;
|
||||
|
||||
if (bitmapContainer.GetHypothesesSize() == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user