Skip to content

Tree node bit caps#151

Draft
theVerySharpFlat wants to merge 5 commits intospaskalev:mainfrom
theVerySharpFlat:main
Draft

Tree node bit caps#151
theVerySharpFlat wants to merge 5 commits intospaskalev:mainfrom
theVerySharpFlat:main

Conversation

@theVerySharpFlat
Copy link
Contributor

These are some changes from a few months back that I made, which you may be interested in.

Essentially, the data stored in nodes before the patch are bitvectors where the most significant set bit implies that all of the less significant bits are also set. Thus, we can simply store the position of the most significant bit as a 1,2,4, or 8 bit integer depending on the depth. This not only saves some space, but also makes some operations feasible in less instructions.

If I remember correctly, the speedup is right around 10%.

Currently, the PR is a little rough around the edges, but if you like the changes here, I'll clean up the comments and document how I generated the LUTs.

@theVerySharpFlat theVerySharpFlat marked this pull request as draft February 27, 2026 20:35
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