-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
nice, benchmarks are really impressive ^^ 👍 |
just good old asm :) |
What about U512? That's even more of a bottleneck currently. |
fn u256_add(b: &mut Bencher) { | ||
b.iter(|| { | ||
let n = black_box(10000); | ||
(0..n).fold(U256::from(1234599u64), |old, new| { old.overflowing_add(U256::from(new)).0 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
benchmark is not very accurate having a call to U256::from
on each iteration.
|
You can also move assembly code to separate |
@marek We want the calls to be inlined. Also less less problems with windows later |
removed warning (cause it's macros expansion, had to ignore it) |
}) | ||
} | ||
|
||
#[cfg(all(feature="x64asm", target_arch = "x86_64"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space around =
.
minor style stuff. can't speak for the logic and i don't see any additional tests... coverage seems to have gone down slightly - is this spurious or an indication that additional code paths need testing? |
@gavofyork |
@debris indeed, Arkady right, inlining gives 2x boost to performance for add/sub |
before
after