Skip to content

perf(chunker): lazy facets map + strconv.FormatUint in mapToNquads#9716

Open
shaunpatterson wants to merge 1 commit into
dgraph-io:mainfrom
shaunpatterson:perf/chunker-lazy-facets
Open

perf(chunker): lazy facets map + strconv.FormatUint in mapToNquads#9716
shaunpatterson wants to merge 1 commit into
dgraph-io:mainfrom
shaunpatterson:perf/chunker-lazy-facets

Conversation

@shaunpatterson
Copy link
Copy Markdown
Contributor

Allocate rawFacets only on the first facet key (most objects have none) and replace fmt.Sprintf("%d", uid) with strconv.FormatUint.

BenchmarkParseJSON (9 nested objects, no facets): allocs/op 517→502 (-2.9%), B/op -1.5%.


Independent change; branched from 4b9b399d (no dependency on the other PRs in this set). Verified: package unit tests pass + Go benchmark (benchstat, p<0.01). Numbers are single-thread microbenchmarks; not yet run through the Docker integration suite.

Allocate rawFacets only on the first facet key (most objects have none) and
replace fmt.Sprintf("%d", uid) with strconv.FormatUint.

BenchmarkParseJSON (9 nested objects, uids, no facets):
  allocs/op 517 -> 502 (-2.90%, p=0.002)
  B/op      33.05Ki -> 32.55Ki (-1.52%, p=0.002)
@shaunpatterson shaunpatterson requested a review from a team as a code owner May 28, 2026 18:18
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