trie
trie copied to clipboard
Simple collect optimization
Was
$ go test -bench . -benchtime 4s
BenchmarkTieKeys-4 1000000 8525 ns/op
BenchmarkPrefixSearch-4 10000 627035 ns/op
BenchmarkFuzzySearch-4 1000 8602394 ns/op
BenchmarkBuildTree-4 30 175859534 ns/op
PASS
ok trie 31.224s
After fix
$ go test -bench . -benchtime 4s
BenchmarkTieKeys-4 1000000 6502 ns/op
BenchmarkPrefixSearch-4 10000 403476 ns/op
BenchmarkFuzzySearch-4 1000 6794919 ns/op
BenchmarkBuildTree-4 30 173354546 ns/op
PASS
ok trie 24.806s