Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upBuilt-in u128 performance compared to extprim crate #39078
Comments
This comment has been minimized.
This comment has been minimized.
|
On which target do you run this, and which one was it compiled for? Also, how does the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Right. I am using a 64 bit Windows GNU target. |
This comment has been minimized.
This comment has been minimized.
|
I think this is the formatter for that crate:
Where the div_rem uses a function udivmodti4 from here: https://github.com/kennytm/extprim/blob/master/src/compiler_rt.rs |
This comment has been minimized.
This comment has been minimized.
|
There’s at most two places where the difference in runtime could come:
Or some combination of two. While the linked
This issue is applicable to intrinsics in general; all of them could benefit from having some of their low hanging fruit plucked. |
This comment has been minimized.
This comment has been minimized.
|
There is at least one place to do a possible speed optimisation: https://github.com/rust-lang/rust/blob/master/src/libcompiler_builtins/lib.rs#L233 Now that we have a benchmark we can actually compare it. However it should also be applied to the libcompiler_builtins crate, as otherwise the time was wasted once that crate gets merged. |
leonardo-m commentedJan 15, 2017
This is a performance bug report.
This little program solves a problem derived from this (a ten times larger problem):
https://projecteuler.net/problem=55
The solution (this is not the fastest solution for this problem, but it's a easy to understand one):
On my PC it runs in about 1.12 seconds.
Using an external crate for the u128 bit values, with the same code (extprim = "1.1.0"):
This runs in about 0.72 seconds.