Skip to content

Avoid clearing fresh normalization bitmap - #59

Open
zachmdsi wants to merge 1 commit into
HigherOrderCO:mainfrom
zachmdsi:perf/avoid-redundant-uset-clear
Open

Avoid clearing fresh normalization bitmap#59
zachmdsi wants to merge 1 commit into
HigherOrderCO:mainfrom
zachmdsi:perf/avoid-redundant-uset-clear

Conversation

@zachmdsi

Copy link
Copy Markdown

Summary

Avoid clearing the normalization visited bitmap immediately after allocating it.

uset_init() obtains fresh MAP_ANONYMOUS storage, which is already zero-filled. The subsequent uset_clear() touched the entire 512 MiB bitmap before every normal evaluation without changing its contents. This removes that call and the now-unused helper, while documenting the initialization invariant.

Measurements

Measured on an Apple M5 with Apple Clang 21 (clang -O2):

  • Trivial program median peak RSS: 538,443,776 B -> 1,605,632 B
  • Avoided approximately 32,766 page reclaims per run
  • lambda_eval median evaluation time: 1.528 s -> 1.481 s
  • cnot_24 median evaluation time: 1.207 s -> 1.201 s

The primary benefit is avoiding a fixed 512 MiB resident-memory cost; timing gains are workload-dependent.

Validation

  • ./devs/test/_all_.sh: 217 passed
  • Normal-mode differential over all 218 test files: byte-identical output and matching exit behavior
  • Identical interaction and heap-allocation counts on measured benchmarks
  • Clean builds with -O0, -O2, -O3, and -Os
  • Representative normal-form programs passed AddressSanitizer and UndefinedBehaviorSanitizer

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