Skip to content

Sort iteration for reproducible builds#275

Open
bmwiedemann wants to merge 1 commit intowilsonzlin:masterfrom
bmwiedemann:sort
Open

Sort iteration for reproducible builds#275
bmwiedemann wants to merge 1 commit intowilsonzlin:masterfrom
bmwiedemann:sort

Conversation

@bmwiedemann
Copy link
Copy Markdown

Sort iteration for reproducible builds
because HashMap uses random seeds to counter DoS attacks, iteration order varied in every run, which made generated attrs.rs and entities.rs non-deterministic.

See https://reproducible-builds.org/ for why this matters.

This patch was done while working on reproducible builds for openSUSE.

because HashMaps use random seeds to counter DoS attacks,
iteration order varied in every run, which made generated
attrs.rs and entities.rs non-deterministic.

This patch was done while working on reproducible builds for openSUSE.
@kpcyrd
Copy link
Copy Markdown

kpcyrd commented Mar 24, 2026

It's probably more efficient to replace ahash::HashMap with std::collections::BTreeMap. minify-html is using ahash::AHashMap, which is the regular std::collections::HashMap but with SipHash 1-3 replaced by the faster ahash.

BTreeMap is already able to outperform HashMap in some cases (for example because of better cpu cache locality with small maps), and as soon as you need deterministic output, it's likely a clear winner. :)

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.

2 participants