Skip to content

Read native map-key bits without rebuilding the key - #1725

Merged
Lorenzobattistela merged 4 commits into
bendlang:mainfrom
oxura:perf/c-map-bit-20261019
Oct 19, 2026
Merged

Lorenzobattistela merged 4 commits into
bendlang:mainfrom
oxura:perf/c-map-bit-20261019

Conversation

@oxura

@oxura oxura commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Map.bit can return the same key without rebuilding every visited String node. This C path walks the original key, decodes the existing 33-bit character slots, and forwards the original key word. Base, JS and the trie encoding are unchanged.

Seven alternating native process pairs on the complete shared-key consumer in #1724: median 115 → 43 ms. Every run returned the independent checksum 16143 and confirmed that the original shared key still matched.

The new boundary program checks empty/NUL keys, presence bits, bit 31/0, character transitions, full U32 character codes and computed positions up to 2^48-1. It passed on native 1/4 threads, Bun and Node. Five existing map/Set/array/sharing programs passed another 15 real runs on Bun and native 1/4 threads. A separate unique-key native consumer passed too. The boundary and unique-key consumers also passed ASan+UBSan with leak detection and empty diagnostics.

Fixes #1724

Removed the GUIDE.md changes as requested in #1644.

@Lorenzobattistela Lorenzobattistela self-assigned this Oct 19, 2026
@Lorenzobattistela
Lorenzobattistela merged commit d729ad2 into bendlang:main Oct 19, 2026
1 check passed
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.

Native Map.bit reconstructs a shared key prefix to read one bit

2 participants