Repository navigation
Conversation
We can squeeze another uint32_t into the immediate path and still make the struct smaller by making the immediate and allocated paths a union. This trims down all integer nodes in the tree, and also doubly trims down rationals.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4319
A bunch of stuff in this one that I've wanted for quite some time.
size_t length; bool negative; uint32_t *values; uint32_t value;we getuint32_t length; bool negative; union { uint32_t value[2]; uint32_t *values; }. This means 64-bit integers can fit in the immediate and don't get allocated. It also means integers go from 20 bytes to 16 bytes, which also impacts rationals doubly.Overall, integer parsing gets about 2x faster, rational parsing about 1.8x faster, short float parsing about 2x faster, and integer printing about 3x faster. We drop retained memory through this as well as the whole AST gets smaller whenever theres an integer or a rational.