Skip to content

perf(mapping): cut allocations building mapping state#71

Draft
seanjnkns wants to merge 1 commit into
sjenkins/perf/backfillstate-hotpathsfrom
sjenkins/perf/mappingstate-hotpaths
Draft

perf(mapping): cut allocations building mapping state#71
seanjnkns wants to merge 1 commit into
sjenkins/perf/backfillstate-hotpathsfrom
sjenkins/perf/mappingstate-hotpaths

Conversation

@seanjnkns
Copy link
Copy Markdown
Contributor

Replace pgBriefMap() in sanitizeStaleUpmaps with a PG brief index scoped to PGIDs that have upmap items. Use slices for sorted upmap items and pre-size slices where lengths are known.

Benchmarks (large fixtures, benchstat vs scaffold baseline):
MustGetCurrentMappingState ~3% faster, 52.7→45.8 MiB B/op, 833k→789k allocs/op
MustGetCurrentMappingStateLegacyJSON ~8% faster, 47.0→40.1 MiB B/op, 833k→789k allocs/op

Replace pgBriefMap() in sanitizeStaleUpmaps with a PG brief index
scoped to PGIDs that have upmap items. Use slices for sorted upmap
items and pre-size slices where lengths are known.

Benchmarks (large fixtures, benchstat vs scaffold baseline):
  MustGetCurrentMappingState ~3% faster, 52.7→45.8 MiB B/op, 833k→789k allocs/op
  MustGetCurrentMappingStateLegacyJSON ~8% faster, 47.0→40.1 MiB B/op, 833k→789k allocs/op
@seanjnkns seanjnkns marked this pull request as draft May 29, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant