-
Notifications
You must be signed in to change notification settings - Fork 72
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
sqrt is slower than expected #134
Comments
I don't think that will change until I rewrite the "backend" digit code with a custom BigInt, rather than using num-bigint::BigInt, which doesn't offer much in terms of direct access to the digits, so there's lots of cloning involved. If you're interested you could make a flamegraph of the calls involved and maybe there's some low hanging fruit that I can pick -- but I have doubts, and wont have much time to dedicate until later this month. |
Hi, thanks for your response. I have done a flamegraph and ~28% of the samples are in For anyone interested, I have made a fork in the meantime that speeds up sqrt by ~100x: trunk...jorisguex:bigdecimal-rs:make-sqrt-faster. It passes all of the unit tests but there may be specific edge cases where it fails (I haven't done that much testing). It also has the benefit of rounding correctly.
|
I was benchmarking the
sqrt
function and I noticed that is was slower than I expected:Compare that to Python:
The text was updated successfully, but these errors were encountered: