Skip to content
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

Uses ruby form to make Ryu representation more human readable. #330

Open
9il opened this issue Mar 10, 2021 · 3 comments
Open

Uses ruby form to make Ryu representation more human readable. #330

9il opened this issue Mar 10, 2021 · 3 comments

Comments

@9il
Copy link
Member

9il commented Mar 10, 2021

Example:
3.0000000000000004e-1 should be just 0.30000000000000004

@9il
Copy link
Member Author

9il commented May 10, 2021

done

@timotheecour
Copy link

timotheecour commented May 12, 2021

@9il sorry if this isn't the right place to ask, but I'd like to make progress on integrating ryu in nim's stdandard library (refs nim-lang/Nim#13365), and I'm wondering what's the best way forward, that doesn't compromise on performance; let's say for now only 32 and 64 bit is needed.

Do you have a link to benchmarks comparing performance for libmir's ryu vs C implementation from https://github.com/ulfjack/ryu/tree/master/ryu?

Given the similarities between nim and D, would you recommend porting libmir's version to nim, or starting "from scratch" from C's version?

Note also that C interop is possible in nim too so that could be a potential alternative if the dependencies involved are small.

What do you think of quality of implementation of these nim ports https://github.com/disruptek/ryu and https://github.com/Clyybber/nimryu (there's also https://github.com/alaviss/nim-ryu but it's not intended for performance, rather for correctness, say to test an implementation)? I'm specifically interested in an implementation that wouldn't compromise on performance (and simplicity of implementation as secondary criterion)

Thanks!

@9il
Copy link
Member Author

9il commented May 12, 2021

@timotheecour I didn't make benchmarks. Mir generic version is derived from original generic 128-bit algorithm. Few CTFE optimisations were added for 32 and 64 bit floats. It definitely much faster than original 128 bit. Likely original specialised 32 and 64 bit algorithms would be faster than Mir, not very significant I think, maybe 5-20%, I don't know.

What do you think of quality of implementation of these nim ports https://github.com/disruptek/ryu and https://github.com/Clyybber/nimryu (there's also https://github.com/alaviss/nim-ryu but it's not intended for performance, rather for correctness, say to test an implementation)? I'm specifically interested in an implementation that wouldn't compromise on performance (and simplicity of implementation as secondary criterion)

I can't say, it requires time to review all the code. The most important note I think: one can't use 64 bit Ryu for 32 bit numbers, that wouldn't work, needs 32 bit Ryu for 32 bit numbers. 128 bit ryu can be used for 128, 80, 64, and 32 bit numbers because it is generic. C code is pretty good, it doesn't have deps if I remember correctly.

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

No branches or pull requests

2 participants