OSH Parser Performance

We time $sh -n $file for various files under various shells, and repeat then run under cachegrind for stable metrics.

Source code: oil/benchmarks/osh-parser.sh

Raw files

Summary

Instructions Per Line (via cachegrind)

Lower numbers are generally better, but each shell recognizes a different language, and OSH uses a more thorough parsing algorithm. In thousands of "I refs".

shell label total lines thousand irefs per line
bash 118,863 15.1
dash 111,674 2.3
osh-native 118,863 13.0
osh-native-souffle 118,863 11.5

(zsh isn't measured because zsh -n unexpectedly forks.)

Average Parsing Rate, Measured on Two Machines (lines/ms)

Shell startup time is included in the elapsed time measurements, but long files are chosen to minimize its effect.

shell label total lines host no-host
dash 111,674 3,818
bash 118,863 971
osh-native-souffle 118,863 536
osh-native 118,863 498
osh-cpython 118,863 16

Per-File Measurements

Time and Memory

shell label elapsed ms user ms sys ms max rss MB num lines filename
dash 1 1 0 2 2,698 Build.sh
bash 3 3 0 3 2,698 Build.sh
osh-native-souffle 6 6 0 8 2,698 Build.sh
osh-native 8 8 0 8 2,698 Build.sh
osh-cpython 207 190 16 21 2,698 Build.sh
dash 1 1 0 2 2,512 abuild
bash 4 4 0 3 2,512 abuild
osh-native-souffle 7 3 3 8 2,512 abuild
osh-native 7 4 4 9 2,512 abuild
osh-cpython 288 271 16 22 2,512 abuild
dash 6 6 0 2 20,489 configure
bash 23 23 0 4 20,489 configure
osh-native-souffle 34 26 9 21 20,489 configure
osh-native 36 32 4 21 20,489 configure
osh-cpython 1,364 1,335 28 43 20,489 configure
dash 15 15 0 2 69,779 configure-coreutils
bash 56 56 0 3 69,779 configure-coreutils
osh-native-souffle 129 109 20 51 69,779 configure-coreutils
osh-native 138 105 32 50 69,779 configure-coreutils
osh-cpython 4,053 3,984 68 86 69,779 configure-coreutils
bash 4 4 0 3 2,029 configure-helper.sh
osh-native-souffle 5 3 3 8 2,029 configure-helper.sh
osh-native 6 0 6 8 2,029 configure-helper.sh
osh-cpython 196 184 12 21 2,029 configure-helper.sh
dash 1 1 0 2 1,733 functions
bash 3 3 0 3 1,733 functions
osh-native-souffle 5 5 0 8 1,733 functions
osh-native 5 5 0 8 1,733 functions
osh-cpython 191 174 16 21 1,733 functions
dash 3 3 0 2 9,661 ltmain.sh
bash 12 12 0 4 9,661 ltmain.sh
osh-native-souffle 16 16 0 15 9,661 ltmain.sh
osh-native 18 14 4 15 9,661 ltmain.sh
osh-cpython 627 606 20 29 9,661 ltmain.sh
dash 1 0 1 2 1,679 t4014-format-patch.sh
bash 3 0 3 3 1,679 t4014-format-patch.sh
osh-native-souffle 3 0 3 7 1,679 t4014-format-patch.sh
osh-native 3 0 3 7 1,679 t4014-format-patch.sh
osh-cpython 75 62 12 19 1,679 t4014-format-patch.sh
dash 1 1 0 1 3,123 t9300-fast-import.sh
bash 3 3 0 3 3,123 t9300-fast-import.sh
osh-native-souffle 3 0 3 7 3,123 t9300-fast-import.sh
osh-native 4 4 0 8 3,123 t9300-fast-import.sh
osh-cpython 79 75 4 19 3,123 t9300-fast-import.sh
bash 11 5 5 3 5,160 test-cmd-util.sh
osh-native-souffle 13 9 4 12 5,160 test-cmd-util.sh
osh-native 14 14 0 12 5,160 test-cmd-util.sh
osh-cpython 565 529 36 27 5,160 test-cmd-util.sh

Instruction Counts

shell label irefs num lines filename
dash 6,417,905 2,698 Build.sh
osh-native-souffle 32,967,884 2,698 Build.sh
bash 35,933,919 2,698 Build.sh
osh-native 37,421,651 2,698 Build.sh
dash 7,043,427 2,512 abuild
bash 43,752,445 2,512 abuild
osh-native-souffle 44,344,690 2,512 abuild
osh-native 45,014,085 2,512 abuild
dash 53,264,106 20,489 configure
osh-native-souffle 241,326,402 20,489 configure
osh-native 275,044,709 20,489 configure
bash 349,528,134 20,489 configure
dash 151,775,776 69,779 configure-coreutils
osh-native-souffle 781,421,092 69,779 configure-coreutils
osh-native 876,669,474 69,779 configure-coreutils
bash 886,051,458 69,779 configure-coreutils
osh-native-souffle 26,553,986 2,029 configure-helper.sh
osh-native 30,531,743 2,029 configure-helper.sh
bash 47,119,656 2,029 configure-helper.sh
dash 4,654,611 1,733 functions
osh-native-souffle 24,865,481 1,733 functions
bash 28,153,410 1,733 functions
osh-native 28,800,159 1,733 functions
dash 23,598,849 9,661 ltmain.sh
osh-native-souffle 97,301,912 9,661 ltmain.sh
osh-native 112,768,536 9,661 ltmain.sh
bash 172,845,801 9,661 ltmain.sh
dash 3,168,267 1,679 t4014-format-patch.sh
osh-native-souffle 10,857,962 1,679 t4014-format-patch.sh
osh-native 11,866,071 1,679 t4014-format-patch.sh
bash 25,320,150 1,679 t4014-format-patch.sh
dash 4,358,947 3,123 t9300-fast-import.sh
osh-native-souffle 12,721,286 3,123 t9300-fast-import.sh
osh-native 13,926,336 3,123 t9300-fast-import.sh
bash 41,145,971 3,123 t9300-fast-import.sh
osh-native-souffle 97,306,979 5,160 test-cmd-util.sh
osh-native 111,933,818 5,160 test-cmd-util.sh
bash 161,991,275 5,160 test-cmd-util.sh

Shell and Host Details

shell label shell id
bash bash-9cc02a91
dash dash-0ebcf347
osh-cpython osh-394d19cc
osh-native osh-d4624c25
osh-native-souffle osh-native-souffle-a9bc3dd5
host label host id
no-host no-host-360e10ed

Raw Data

filename
no-host.2024-11-22__22-58-31.cachegrind.tsv
no-host.2024-11-22__22-58-31.times.csv