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: oils/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.6
osh-souffle 118,863 11.1

(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,601
bash 118,863 1,269
osh-souffle 118,863 466
osh-native 118,863 432
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 1 1 2 2,698 Build.sh
bash 3 2 1 3 2,698 Build.sh
osh-souffle 7 4 4 8 2,698 Build.sh
osh-native 8 4 4 9 2,698 Build.sh
osh-cpython 332 309 24 21 2,698 Build.sh
dash 2 1 1 2 2,512 abuild
bash 4 2 1 3 2,512 abuild
osh-souffle 9 5 4 9 2,512 abuild
osh-native 10 6 4 9 2,512 abuild
osh-cpython 453 426 26 22 2,512 abuild
dash 9 9 0 2 20,489 configure
bash 17 15 2 4 20,489 configure
osh-souffle 40 34 6 21 20,489 configure
osh-native 43 32 11 22 20,489 configure
osh-cpython 2,172 2,131 40 44 20,489 configure
dash 23 22 1 2 69,779 configure-coreutils
bash 42 42 0 4 69,779 configure-coreutils
osh-souffle 141 120 21 50 69,779 configure-coreutils
osh-native 154 133 20 50 69,779 configure-coreutils
osh-cpython 6,336 6,234 102 91 69,779 configure-coreutils
bash 3 3 0 3 2,029 configure-helper.sh
osh-souffle 6 3 3 9 2,029 configure-helper.sh
osh-native 7 3 4 9 2,029 configure-helper.sh
osh-cpython 315 291 24 21 2,029 configure-helper.sh
dash 1 1 1 2 1,733 functions
bash 3 1 1 3 1,733 functions
osh-souffle 6 4 3 8 1,733 functions
osh-native 7 6 1 9 1,733 functions
osh-cpython 305 290 15 21 1,733 functions
dash 4 4 0 2 9,661 ltmain.sh
bash 9 7 2 4 9,661 ltmain.sh
osh-souffle 20 15 5 16 9,661 ltmain.sh
osh-native 21 14 7 16 9,661 ltmain.sh
osh-cpython 1,035 994 41 30 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-souffle 4 2 2 7 1,679 t4014-format-patch.sh
osh-native 4 2 2 8 1,679 t4014-format-patch.sh
osh-cpython 114 98 16 19 1,679 t4014-format-patch.sh
dash 1 1 0 1 3,123 t9300-fast-import.sh
bash 2 2 1 3 3,123 t9300-fast-import.sh
osh-souffle 4 3 1 8 3,123 t9300-fast-import.sh
osh-native 4 2 3 8 3,123 t9300-fast-import.sh
osh-cpython 126 107 19 19 3,123 t9300-fast-import.sh
bash 8 8 0 3 5,160 test-cmd-util.sh
osh-souffle 17 12 5 13 5,160 test-cmd-util.sh
osh-native 18 15 3 13 5,160 test-cmd-util.sh
osh-cpython 926 906 20 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-souffle 31,313,595 2,698 Build.sh
osh-native 35,547,959 2,698 Build.sh
dash 7,343,949 2,512 abuild
bash 23,565,556 2,512 abuild
osh-souffle 44,294,530 2,512 abuild
osh-native 51,820,946 2,512 abuild
dash 55,988,249 20,489 configure
bash 166,228,288 20,489 configure
osh-souffle 231,848,011 20,489 configure
osh-native 263,662,757 20,489 configure
dash 161,007,687 69,779 configure-coreutils
bash 440,577,808 69,779 configure-coreutils
osh-souffle 754,127,416 69,779 configure-coreutils
osh-native 842,972,352 69,779 configure-coreutils
bash 22,785,798 2,029 configure-helper.sh
osh-souffle 25,668,575 2,029 configure-helper.sh
osh-native 29,934,159 2,029 configure-helper.sh
dash 4,811,021 1,733 functions
bash 15,304,971 1,733 functions
osh-souffle 24,134,247 1,733 functions
osh-native 28,506,172 1,733 functions
dash 24,901,464 9,661 ltmain.sh
bash 80,225,385 9,661 ltmain.sh
osh-souffle 95,410,332 9,661 ltmain.sh
osh-native 111,617,443 9,661 ltmain.sh
dash 3,292,797 1,679 t4014-format-patch.sh
osh-souffle 9,965,481 1,679 t4014-format-patch.sh
osh-native 10,954,285 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-souffle 11,701,417 3,123 t9300-fast-import.sh
osh-native 12,851,444 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-souffle 95,578,495 5,160 test-cmd-util.sh
osh-native 111,575,894 5,160 test-cmd-util.sh

Shell and Host Details

shell label shell id
bash bash-36833674
dash dash-cea41b3e
osh-cpython osh-e0c1618a
osh-native osh-4614c963
osh-souffle osh-souffle-c4311af0
host label host id
no-host no-host-31404de8

Raw Data

filename
no-host.2025-06-25__15-02-38.cachegrind.tsv
no-host.2025-06-25__15-02-38.times.csv