mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Check compound distance of node and prune useless node after creating new word.
Before: 136309.89 ms After: 73133.95 ms Bug: 8591918 Change-Id: If029b768e2b459c0e566188bcf425f71b2df866d
This commit is contained in:
parent
286877b3af
commit
2d3f2daf12
@ -530,6 +530,12 @@ void Suggest::createNextWordDicNode(DicTraverseSession *traverseSession, DicNode
|
|||||||
CT_NEW_WORD_SPACE_SUBSTITUTION : CT_NEW_WORD_SPACE_OMITTION;
|
CT_NEW_WORD_SPACE_SUBSTITUTION : CT_NEW_WORD_SPACE_OMITTION;
|
||||||
Weighting::addCostAndForwardInputIndex(WEIGHTING, correctionType, traverseSession, dicNode,
|
Weighting::addCostAndForwardInputIndex(WEIGHTING, correctionType, traverseSession, dicNode,
|
||||||
&newDicNode, traverseSession->getMultiBigramMap());
|
&newDicNode, traverseSession->getMultiBigramMap());
|
||||||
traverseSession->getDicTraverseCache()->copyPushNextActive(&newDicNode);
|
if (newDicNode.getCompoundDistance() < static_cast<float>(MAX_VALUE_FOR_WEIGHTING)) {
|
||||||
|
// newDicNode is worth continuing to traverse.
|
||||||
|
// CAVEAT: This pruning is important for speed. Remove this when we can afford not to prune
|
||||||
|
// here because here is not the right place to do pruning. Pruning should take place only
|
||||||
|
// in DicNodePriorityQueue.
|
||||||
|
traverseSession->getDicTraverseCache()->copyPushNextActive(&newDicNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace latinime
|
} // namespace latinime
|
||||||
|
Loading…
Reference in New Issue
Block a user