You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D196 follow-up: measure the probe count of the compiler's maps now that they hash with Minted #3087
D196 asked, after the src/ Minted sweep (#3084): a third of with check in SipHash over four bytes suggested the maps are probed far more than needed, so the second win may be the probe count. Measure it: instrument hm_find/the probe loop under WITH_DEBUG_ALLOC or a new counter env (WITH_TRACE_HM_PROBES=1, a histogram of probes per lookup by map), run check src/main.w, and read which maps probe most and why (load factor, the mixer, key clustering). The timing so far: unswept 125–177 s vs swept 100–108 s for check src/main.w under load.
The top live maps: the 16-byte str map with 106,269 entries (the symbol pool) takes 147M lookups at 1.02 slots; a 4-byte minted map holding 3 entries takes 4.2M; a 12,822-entry minted map 2.4M at 1.31.
What this says:
Probing is not the second win. 89% of lookups read exactly one slot; the mean is 1.17 (minted 1.18, str 1.06). The index is rebuilt at 2/3 load and the mixer spreads sequential IDs; there is no clustering to fix. The 2,530 lookups that read 65+ slots are all in short-lived maps (none of the live top twenty exceeds 2.12).
The volume is the cost: 2.6 billion lookups in one check, 26M per second. 90% of them (2.36B) are on 40,178 minted-keyed maps that are created and freed during the check, i.e. per-body or per-instance tables in Sema and MIR, not the module-wide ones. The str symbol pool is the only long-lived map that matters, and it is already at 1.02.
So the next measurement is which creation sites make the 40k maps and which lookups on them repeat (a body-local table rebuilt per body, or one lookup per node per pass). The counter cannot name a site from the runtime; the follow-on is a WITH_TRACE_HM_PROBES=2 mode that prints a backtrace at the creation of any map whose lookups exceed a threshold when it is freed, or Sema-side counting at the HashMap.new() sites of check_fn_body_with_sig_once.
Landed in #3091 (WITH_TRACE_HM_PROBES=1), measurement posted above: probing is at its floor (1.17 slots per lookup); the cost is 2.6 billion lookups, 90% on 40,178 short-lived minted-keyed maps. The creation-site attribution is the next question and gets its own issue.
Activity
ehartford commentedon Nov 8, 2026
Measured with
WITH_TRACE_HM_PROBES=1(the runtime counter this issue's PR adds;out/stage/bin/with-stage2 check src/main.won a tree at #3084):The top live maps: the 16-byte str map with 106,269 entries (the symbol pool) takes 147M lookups at 1.02 slots; a 4-byte minted map holding 3 entries takes 4.2M; a 12,822-entry minted map 2.4M at 1.31.
What this says:
check, 26M per second. 90% of them (2.36B) are on 40,178 minted-keyed maps that are created and freed during the check, i.e. per-body or per-instance tables in Sema and MIR, not the module-wide ones. The str symbol pool is the only long-lived map that matters, and it is already at 1.02.WITH_TRACE_HM_PROBES=2mode that prints a backtrace at the creation of any map whose lookups exceed a threshold when it is freed, or Sema-side counting at theHashMap.new()sites ofcheck_fn_body_with_sig_once.#3087: WITH_TRACE_HM_PROBES=1 counts the index slots every map lookup…
ehartford commentedon Nov 8, 2026
Landed in #3091 (
WITH_TRACE_HM_PROBES=1), measurement posted above: probing is at its floor (1.17 slots per lookup); the cost is 2.6 billion lookups, 90% on 40,178 short-lived minted-keyed maps. The creation-site attribution is the next question and gets its own issue.#3093: WITH_TRACE_HM_PROBES=<N> reports a map freed after N lookups w…