[Bug 14391] sha1sum slow on x64 and possibly others
bugzilla at busybox.net
bugzilla at busybox.net
Wed Dec 29 21:23:29 UTC 2021
https://bugs.busybox.net/show_bug.cgi?id=14391
--- Comment #2 from Błażej Roszkowski <blazejroszkowski at gmail.com> ---
I'm not sure which is 'outer' loop. In busybox code the outermost loop is for
(i = 0; i < 4; i++).
In my opinion unrolling it is also worth it (but unrolling full 80 stages is
more drastic performance and size jump).
I unrolled it in busybox messily (there still is one if with goto in stage 1)
by copy pasting entire body of the loop 4 times and deleting parts not relevant
to given i value for that copy.
Time for 1 GB went from 5.3 to 4.7 (I'm eyeballing but it's 100% noticeable
even with random fluctuations of 0.1-0.3 between runs)
sha1_process_block64 size went from 361 to 672. Executable size stayed at
976568.
I'm guessing it's because code is denser when generated per stage (constant
inlined, no ifs and jumps).
Here's a commit I also made to test rolling my 80 steps back into 4 for loops
of 20:
https://github.com/FRex/blasha1/commit/c5a3e5d5d6d0e85f73934e2446fa56fcbc95adeb
1 GB file on Fedora VM takes (in order: my code, my rolled code, busybox,
busybox unrolled 4 for loops): 2.4, 4, 5.3, 4.7
On Windows (I didn't test unrolled 4 for loop busybox): 2.4, 3.6, 5.5
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list