Skip to content

Faster fixnums (preview) #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

radiospiel
Copy link
Contributor

No description provided.

This commit provides an alternative implementation for a long → decimal conversion.

The main difference is that it uses an algorithm pulled from https://github.com/jeaiii/itoa. The source there is C++, it was converted by hand to C for inclusion with this gem. A writeup of this algorithm can be found here. jeaiii's algorithm is covered by the MIT License, see source code.

On addition this version now also generates the string directly into the fbuffer, foregoing the need to run a separate memory copy.

As a result, I see a speedup of 32% on Apple Silicon M1 for an integer set of benchmarks.
This commit moves the ltoa.h header file directly into the vendor directory, for consistency with other vendored sources.
It also adds the file as a build dependency.
@radiospiel radiospiel closed this Mar 21, 2025
@radiospiel
Copy link
Contributor Author

(Sorry, pushed into this repo by mistake.)

@radiospiel radiospiel deleted the eno/preview/fixnums branch March 21, 2025 21:48
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