Bash benchmarks

When writing bash scripts, one needs to find ways to do things that aren’t built in to bash. String manipulation like lowercase conversion, parsing, removing whitespace… all use tools/binaries built-in to the OS, but not in the language itself. I’m talking about tools like cut, awk, tr, sed, sort, …

Update: I now have developed benchmarking for both throughput (MB/s) and invocation (ops/sec) speed in my project, combined with all kinds of other improvements, so the content in this article was updated [2022-04-08]

Most of the time, there is more than one way to do something. So the question I would like to answer: what is the fastest way to do them, fastest either in the meaning of “throughput”, expressed in lines/second or MB/sec, or in “invocation” speed, how many times can I start up the program sequantially, expressed in operations/sec.

I’ve started a GitHub repo pforret/bash_benchmarks to collect these benchmarks.

Bash benchmarks

In short:

Please find all the posts in these series under the bash-benchmark tag

💬 bash 🏷 benchmark 🏷 bash 🏷 throughput 🏷 bash-benchmark 🏷 github