Skip to content

perf(tok): pre-size terms slice in uniqueTerms#9724

Open
shaunpatterson wants to merge 1 commit into
dgraph-io:mainfrom
shaunpatterson:perf/tok-uniqueterms
Open

perf(tok): pre-size terms slice in uniqueTerms#9724
shaunpatterson wants to merge 1 commit into
dgraph-io:mainfrom
shaunpatterson:perf/tok-uniqueterms

Conversation

@shaunpatterson
Copy link
Copy Markdown
Contributor

Pre-size the terms slice to len(tokens) instead of growing from nil. Also un-skips BenchmarkTermTokenizer with a real workload.

BenchmarkTermTokenizer: allocs -24% geomean, B/op -14% geomean.


Independent change; branched from 4b9b399d. Verified: package unit tests pass + Go benchmark (benchstat, p<0.01). Single-thread microbenchmarks; not yet run through the Docker integration suite.

Pre-size the terms slice to len(tokens) instead of growing from nil. Also
un-skips BenchmarkTermTokenizer with a real workload.

BenchmarkTermTokenizer: allocs -24% geomean, B/op -14% geomean.
@shaunpatterson shaunpatterson requested a review from a team as a code owner May 28, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant