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,604
bash 118,863 1,276
osh-native-souffle 118,863 507
osh-native 118,863 475
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 0 2 2 2,698 Build.sh
bash 3 2 1 3 2,698 Build.sh
osh-native-souffle 7 4 2 8 2,698 Build.sh
osh-native 7 2 6 9 2,698 Build.sh
osh-cpython 315 290 25 21 2,698 Build.sh
dash 2 2 0 2 2,512 abuild
bash 4 2 2 3 2,512 abuild
osh-native-souffle 8 7 1 9 2,512 abuild
osh-native 9 5 4 9 2,512 abuild
osh-cpython 421 396 25 22 2,512 abuild
dash 9 8 1 2 20,489 configure
bash 17 16 1 4 20,489 configure
osh-native-souffle 39 31 8 21 20,489 configure
osh-native 42 35 7 22 20,489 configure
osh-cpython 2,070 2,040 30 44 20,489 configure
dash 23 23 0 2 69,779 configure-coreutils
bash 42 42 0 4 69,779 configure-coreutils
osh-native-souffle 128 102 26 50 69,779 configure-coreutils
osh-native 133 110 23 50 69,779 configure-coreutils
osh-cpython 6,039 5,949 90 91 69,779 configure-coreutils
bash 3 2 1 3 2,029 configure-helper.sh
osh-native-souffle 6 2 4 8 2,029 configure-helper.sh
osh-native 7 4 3 9 2,029 configure-helper.sh
osh-cpython 297 276 21 21 2,029 configure-helper.sh
dash 1 1 1 2 1,733 functions
bash 3 3 0 3 1,733 functions
osh-native-souffle 6 4 2 8 1,733 functions
osh-native 6 6 0 9 1,733 functions
osh-cpython 295 278 18 21 1,733 functions
dash 4 4 1 2 9,661 ltmain.sh
bash 9 8 1 4 9,661 ltmain.sh
osh-native-souffle 18 13 5 15 9,661 ltmain.sh
osh-native 20 14 6 16 9,661 ltmain.sh
osh-cpython 976 941 35 29 9,661 ltmain.sh
dash 1 0 1 2 1,679 t4014-format-patch.sh
bash 2 1 1 3 1,679 t4014-format-patch.sh
osh-native-souffle 4 1 3 7 1,679 t4014-format-patch.sh
osh-native 4 3 1 8 1,679 t4014-format-patch.sh
osh-cpython 112 87 24 19 1,679 t4014-format-patch.sh
dash 1 1 0 2 3,123 t9300-fast-import.sh
bash 2 2 1 3 3,123 t9300-fast-import.sh
osh-native-souffle 4 1 3 8 3,123 t9300-fast-import.sh
osh-native 4 0 4 8 3,123 t9300-fast-import.sh
osh-cpython 117 92 25 19 3,123 t9300-fast-import.sh
bash 8 6 2 3 5,160 test-cmd-util.sh
osh-native-souffle 16 12 4 12 5,160 test-cmd-util.sh
osh-native 18 10 8 13 5,160 test-cmd-util.sh
osh-cpython 882 848 34 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,025,908 2,698 Build.sh
osh-native 35,328,181 2,698 Build.sh
dash 7,343,949 2,512 abuild
bash 23,565,556 2,512 abuild
osh-native-souffle 36,272,511 2,512 abuild
osh-native 42,287,273 2,512 abuild
dash 55,988,249 20,489 configure
bash 166,228,288 20,489 configure
osh-native-souffle 230,492,486 20,489 configure
osh-native 262,730,035 20,489 configure
dash 161,007,687 69,779 configure-coreutils
bash 440,577,808 69,779 configure-coreutils
osh-native-souffle 752,987,087 69,779 configure-coreutils
osh-native 844,265,469 69,779 configure-coreutils
bash 22,785,798 2,029 configure-helper.sh
osh-native-souffle 24,672,360 2,029 configure-helper.sh
osh-native 28,495,077 2,029 configure-helper.sh
dash 4,811,021 1,733 functions
bash 15,304,971 1,733 functions
osh-native-souffle 23,046,695 1,733 functions
osh-native 26,854,087 1,733 functions
dash 24,901,464 9,661 ltmain.sh
bash 80,225,385 9,661 ltmain.sh
osh-native-souffle 91,924,281 9,661 ltmain.sh
osh-native 106,791,395 9,661 ltmain.sh
dash 3,292,797 1,679 t4014-format-patch.sh
osh-native-souffle 9,908,367 1,679 t4014-format-patch.sh
osh-native 10,887,259 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,712,260 3,123 t9300-fast-import.sh
osh-native 12,891,980 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,380,478 5,160 test-cmd-util.sh
osh-native 106,840,444 5,160 test-cmd-util.sh

Shell and Host Details

shell label shell id
bash bash-431918c4
dash dash-cea41b3e
osh-cpython osh-f1b42153
osh-native osh-c6b87ae7
osh-native-souffle osh-native-souffle-089f8ae1
host label host id
no-host no-host-2411472

Raw Data

filename
no-host.2025-05-18__11-57-18.cachegrind.tsv
no-host.2025-05-18__11-57-18.times.csv