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 7.3
dash 111,674 2.4
osh-native 118,863 12.4
osh-native-souffle 118,863 11.0

(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 2,610
bash 118,863 1,284
osh-native-souffle 118,863 494
osh-native 118,863 464
osh-cpython 118,863 10

Per-File Measurements

Time and Memory

shell label elapsed ms user ms sys ms max rss MB num lines filename
dash 2 2 0 2 2,698 Build.sh
bash 3 2 1 3 2,698 Build.sh
osh-native-souffle 7 5 2 8 2,698 Build.sh
osh-native 7 5 2 9 2,698 Build.sh
osh-cpython 318 295 22 21 2,698 Build.sh
dash 2 2 0 2 2,512 abuild
bash 4 3 1 3 2,512 abuild
osh-native-souffle 8 5 3 9 2,512 abuild
osh-native 8 7 1 9 2,512 abuild
osh-cpython 443 416 27 22 2,512 abuild
dash 9 7 2 2 20,489 configure
bash 17 15 2 4 20,489 configure
osh-native-souffle 40 29 11 21 20,489 configure
osh-native 43 36 7 22 20,489 configure
osh-cpython 2,091 2,049 39 44 20,489 configure
dash 23 22 1 2 69,779 configure-coreutils
bash 42 40 2 3 69,779 configure-coreutils
osh-native-souffle 130 101 29 50 69,779 configure-coreutils
osh-native 140 118 22 50 69,779 configure-coreutils
osh-cpython 6,190 6,111 79 91 69,779 configure-coreutils
bash 3 2 1 3 2,029 configure-helper.sh
osh-native-souffle 6 5 1 9 2,029 configure-helper.sh
osh-native 6 3 3 9 2,029 configure-helper.sh
osh-cpython 307 277 30 21 2,029 configure-helper.sh
dash 1 1 1 2 1,733 functions
bash 3 2 1 3 1,733 functions
osh-native-souffle 6 3 3 8 1,733 functions
osh-native 6 4 3 9 1,733 functions
osh-cpython 296 274 22 21 1,733 functions
dash 4 4 0 2 9,661 ltmain.sh
bash 9 7 2 4 9,661 ltmain.sh
osh-native-souffle 19 17 2 15 9,661 ltmain.sh
osh-native 20 15 5 16 9,661 ltmain.sh
osh-cpython 1,002 971 30 29 9,661 ltmain.sh
dash 1 1 0 1 1,679 t4014-format-patch.sh
bash 2 0 2 3 1,679 t4014-format-patch.sh
osh-native-souffle 4 3 1 7 1,679 t4014-format-patch.sh
osh-native 4 2 2 8 1,679 t4014-format-patch.sh
osh-cpython 112 87 24 19 1,679 t4014-format-patch.sh
dash 1 0 1 1 3,123 t9300-fast-import.sh
bash 2 1 1 3 3,123 t9300-fast-import.sh
osh-native-souffle 4 3 1 8 3,123 t9300-fast-import.sh
osh-native 4 3 1 8 3,123 t9300-fast-import.sh
osh-cpython 118 95 24 19 3,123 t9300-fast-import.sh
bash 8 7 1 3 5,160 test-cmd-util.sh
osh-native-souffle 16 11 5 12 5,160 test-cmd-util.sh
osh-native 18 12 6 13 5,160 test-cmd-util.sh
osh-cpython 901 873 28 28 5,160 test-cmd-util.sh

Instruction Counts

shell label irefs num lines filename
dash 6,683,550 2,698 Build.sh
bash 19,397,953 2,698 Build.sh
osh-native-souffle 31,134,441 2,698 Build.sh
osh-native 35,309,707 2,698 Build.sh
dash 7,343,949 2,512 abuild
bash 23,565,556 2,512 abuild
osh-native-souffle 36,444,070 2,512 abuild
osh-native 42,252,266 2,512 abuild
dash 55,988,249 20,489 configure
bash 166,228,288 20,489 configure
osh-native-souffle 231,299,302 20,489 configure
osh-native 262,634,155 20,489 configure
dash 161,007,687 69,779 configure-coreutils
bash 440,577,808 69,779 configure-coreutils
osh-native-souffle 755,376,715 69,779 configure-coreutils
osh-native 843,935,082 69,779 configure-coreutils
bash 22,785,798 2,029 configure-helper.sh
osh-native-souffle 24,779,646 2,029 configure-helper.sh
osh-native 28,481,383 2,029 configure-helper.sh
dash 4,811,021 1,733 functions
bash 15,304,971 1,733 functions
osh-native-souffle 23,153,428 1,733 functions
osh-native 26,834,304 1,733 functions
dash 24,901,464 9,661 ltmain.sh
bash 80,225,385 9,661 ltmain.sh
osh-native-souffle 92,285,890 9,661 ltmain.sh
osh-native 106,722,230 9,661 ltmain.sh
dash 3,292,797 1,679 t4014-format-patch.sh
osh-native-souffle 9,927,988 1,679 t4014-format-patch.sh
osh-native 10,881,366 1,679 t4014-format-patch.sh
bash 11,084,082 1,679 t4014-format-patch.sh
dash 4,583,408 3,123 t9300-fast-import.sh
osh-native-souffle 11,730,609 3,123 t9300-fast-import.sh
osh-native 12,886,565 3,123 t9300-fast-import.sh
bash 16,672,903 3,123 t9300-fast-import.sh
bash 73,188,823 5,160 test-cmd-util.sh
osh-native-souffle 92,742,962 5,160 test-cmd-util.sh
osh-native 106,794,628 5,160 test-cmd-util.sh

Shell and Host Details

shell label shell id
bash bash-fbb973c4
dash dash-cea41b3e
osh-cpython osh-a505ac64
osh-native osh-daa0435e
osh-native-souffle osh-native-souffle-44845656
host label host id
no-host no-host-31404de8

Raw Data

filename
no-host.2025-06-14__04-46-46.cachegrind.tsv
no-host.2025-06-14__04-46-46.times.csv