[Bug 14391] New: sha1sum slow on x64 and possibly others

bugzilla at busybox.net bugzilla at busybox.net
Thu Nov 25 21:28:30 UTC 2021


https://bugs.busybox.net/show_bug.cgi?id=14391

            Bug ID: 14391
           Summary: sha1sum slow on x64 and possibly others
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: blazejroszkowski at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Created attachment 9171
  --> https://bugs.busybox.net/attachment.cgi?id=9171&action=edit
dot config file from my build on Fedora VM

sha1sum in BusyBox is over twice as slow as decently optimized C
implementation.

All tests were done on x64-86 (VMs and real OSes, Windws and Linux, two
laptops). I don't know if this is a performance problem on other architectures
(I'd guess it is).

Test file (1 GiB): dd if=/dev/urandom of=gig.gig bs=1024 count=$((1024 * 1024))

GNU coreutils sha1sum (Git for Windows, no libcrypto use) and my own
implementation take (on my personal laptop) 2.8 seconds.

BusyBox takes 6.3 seconds. It's around 2x slower on my work laptop as well.

This is present in at least versions: 1.34.1 (my own build on Fedora 34,
.config attached), 1.34.1 in latest Alpine (3.15.0), 1.34.1 from Fedora 34
repos, 1.34.0 on Windows.

I also remember it being present on Ubuntu 18.04 LTS and 20.04 LTS as well
(busybox from the repos).

My optimized plain C sha1 implementation (that I'm happy to contribute) is
here: https://github.com/FRex/blasha1

The only downside I see from using optimized C version is potential increase in
binary size, since optimized code is heavily unrolled (but I didn't investigate
this increase).

I've searched for "performance", "sha1", "sha1sum", and "speed" on this
Bugzilla and found nothing about this.

I understand it's an old semi-obsolete algorithm but if BusyBox provides this
util, I assume it's better that it's faster rather than slower.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list