Skip to content

Commit

Permalink
utilities: Add preallocate for encoded (#3024)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashamelentyev committed Nov 22, 2022
1 parent 61c88d4 commit c3362bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utilities/trie.go
Expand Up @@ -40,7 +40,7 @@ func NewDoubleArray(seqs [][]string) *DoubleArray {
func registerTokens(da *DoubleArray, seqs [][]string) [][]int {
var result [][]int
for _, seq := range seqs {
var encoded []int
encoded := make([]int, 0, len(seq))
for _, token := range seq {
if _, ok := da.Encoding[token]; !ok {
da.Encoding[token] = len(da.Encoding)
Expand Down

0 comments on commit c3362bf

Please sign in to comment.