Skip to content

get-project-path.sh: Speed up by ca 50%

Katrin Leinweber requested to merge speed-up-project-hash into main

What does this MR do and why?

Benchmarking different variants with hyperfine, I found the current openssl variant to be somewhat slower than strictly necessary:

echo -n 1 | sha256sum | sed 's/\s.+$//' ran
    1.08 ± 0.43 times faster than   echo -n 1 | sha256sum | cut -f1 -d' '
    1.62 ± 0.14 times faster than   echo -n 1 | openssl dgst -sha256 | sed 's/^.* //'
   14.17 ± 13.3 times faster than   echo -n 1 | sha256sum | ugrep -o '\w+'

If sha256sum can be assumed as installed on the OSes we support, we could switch to that.

Screenshots, recordings or output

How to set up and validate locally

Copy new command into terminal & run.

MR acceptance checklist

  • I've tested this change on: macOS /Linux.
  • This change needs no other test and thus no review …
    • This does need at least 1 additional test on another machine, ideally using a different OS. I've facilitated this via: MR review.
Edited by Katrin Leinweber

Merge request reports