Skip to content

Conversation

@anderseknert
Copy link
Member

This PR adds interning of strings representing common integer values, which greatly speeds up "to string" operations on numbers, and updates some built-ins commonly used for this to make use of interned values where possible.

This is "light" version of a previous PR that did this more aggressively, but also came with more caveats. Importantly, interning of new strings is now never done at "runtime", but only allowed at init time. The API for interning is marked experimental and should not relied upon by anyone who expects a stable API.

Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Some comments (maybe a thing or two to fix)

@anderseknert anderseknert force-pushed the int-string-interning branch from 76feb23 to d5446bd Compare May 28, 2025 20:48
This PR adds interning of strings representing common integer values,
which greatly speeds up "to string" operations on numbers, and updates
some built-ins commonly used for this to make use of interned values
where possible.

This is "light" version of a previous PR that did this more aggressively,
but also came with more caveats. Importantly, interning of new strings is
now never done at "runtime", but only allowed at init time. The API for
interning is marked experimental and should not relied upon by anyone
who expects a stable API.

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert anderseknert force-pushed the int-string-interning branch from d5446bd to 1914537 Compare May 28, 2025 20:55
@anderseknert anderseknert merged commit 20fe70e into open-policy-agent:main May 28, 2025
28 checks passed
@anderseknert anderseknert deleted the int-string-interning branch May 28, 2025 21:19
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.

2 participants