Skip to content

apk: build the resolver name map without per-package allocations - #2466

Draft
markusthoemmes wants to merge 1 commit into
chainguard-dev:mainfrom
markusthoemmes:resolver-allocs
Draft

markusthoemmes wants to merge 1 commit into
chainguard-dev:mainfrom
markusthoemmes:resolver-allocs

Conversation

@markusthoemmes

Copy link
Copy Markdown
Member

Count entries per name first, carve every name's slice out of one backing array, and fill through per-name buckets so the map is never written during the fill. Package wrappers live in one slab. On the Wolfi x86_64 index a build drops from 236k allocations and 22.6 MB to under a thousand allocations and 18 MB. Build time is unchanged, the point is less garbage for the collector under memory pressure. Providers of a name are now appended in index order rather than map iteration order, which only affects tie-breaking and makes it deterministic.

Count entries per name first, carve every name's slice out of one backing array, and fill through per-name buckets so the map is never written during the fill. Package wrappers live in one slab. On the Wolfi x86_64 index a build drops from 236k allocations and 22.6 MB to under a thousand allocations and 18 MB. Build time is unchanged, the point is less garbage for the collector under memory pressure. Providers of a name are now appended in index order rather than map iteration order, which only affects tie-breaking and makes it deterministic.
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