Based on my benchmark, time was 1m23s before this change and 1m8s after, which is about an 18% reduction in runtime.
The current code creates a new string and WordInfo object for every
single LatticeNode. The WordInfo is only used if the word is an unk, and
it's never modified. This change makes just one instance which all
LatticeNodes return if they need to.
Based on my benchmark, time was 1m23s before this change and 1m8s after, which is about an 18% reduction in runtime.
The current code creates a new string and WordInfo object for every single LatticeNode. The WordInfo is only used if the word is an unk, and it's never modified. This change makes just one instance which all LatticeNodes return if they need to.
This is part of #74 .