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 11.0
osh-nosouffle 118,863 12.6

(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,577
bash 118,863 1,259
osh-native 118,863 456
osh-nosouffle 118,863 405
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 8 5 3 9 2,698 Build.sh
osh-nosouffle 8 5 3 9 2,698 Build.sh
osh-cpython 327 298 29 22 2,698 Build.sh
dash 2 2 0 2 2,512 abuild
bash 4 2 2 3 2,512 abuild
osh-native 9 6 3 9 2,512 abuild
osh-nosouffle 10 8 2 9 2,512 abuild
osh-cpython 455 426 29 22 2,512 abuild
dash 9 5 4 2 20,489 configure
bash 17 16 1 4 20,489 configure
osh-native 41 30 11 23 20,489 configure
osh-nosouffle 43 35 8 23 20,489 configure
osh-cpython 2,143 2,101 42 44 20,489 configure
dash 23 23 0 2 69,779 configure-coreutils
bash 43 40 3 4 69,779 configure-coreutils
osh-native 143 118 25 52 69,779 configure-coreutils
osh-nosouffle 169 148 21 52 69,779 configure-coreutils
osh-cpython 6,296 6,230 65 91 69,779 configure-coreutils
bash 3 3 0 3 2,029 configure-helper.sh
osh-native 7 4 3 8 2,029 configure-helper.sh
osh-nosouffle 7 3 4 9 2,029 configure-helper.sh
osh-cpython 321 293 28 21 2,029 configure-helper.sh
dash 1 1 0 2 1,733 functions
bash 3 2 1 3 1,733 functions
osh-native 6 5 1 9 1,733 functions
osh-nosouffle 7 6 1 9 1,733 functions
osh-cpython 311 285 26 21 1,733 functions
dash 4 4 0 2 9,661 ltmain.sh
bash 9 7 2 4 9,661 ltmain.sh
osh-native 20 12 8 16 9,661 ltmain.sh
osh-nosouffle 22 20 2 16 9,661 ltmain.sh
osh-cpython 1,023 994 29 30 9,661 ltmain.sh
dash 1 0 1 2 1,679 t4014-format-patch.sh
bash 2 2 0 3 1,679 t4014-format-patch.sh
osh-native 4 3 1 7 1,679 t4014-format-patch.sh
osh-nosouffle 4 2 2 8 1,679 t4014-format-patch.sh
osh-cpython 117 99 18 19 1,679 t4014-format-patch.sh
dash 1 0 1 1 3,123 t9300-fast-import.sh
bash 2 2 1 3 3,123 t9300-fast-import.sh
osh-native 4 1 3 8 3,123 t9300-fast-import.sh
osh-nosouffle 5 3 2 8 3,123 t9300-fast-import.sh
osh-cpython 121 102 19 19 3,123 t9300-fast-import.sh
bash 8 8 0 3 5,160 test-cmd-util.sh
osh-native 18 11 7 13 5,160 test-cmd-util.sh
osh-nosouffle 19 12 7 13 5,160 test-cmd-util.sh
osh-cpython 933 911 22 28 5,160 test-cmd-util.sh

Instruction Counts

shell label irefs num lines filename
dash 6,684,258 2,698 Build.sh
bash 19,403,577 2,698 Build.sh
osh-native 31,592,089 2,698 Build.sh
osh-nosouffle 35,839,862 2,698 Build.sh
dash 7,346,197 2,512 abuild
bash 23,586,858 2,512 abuild
osh-native 44,708,804 2,512 abuild
osh-nosouffle 52,273,698 2,512 abuild
dash 55,988,490 20,489 configure
bash 166,013,802 20,489 configure
osh-native 221,047,064 20,489 configure
osh-nosouffle 263,041,028 20,489 configure
dash 161,016,284 69,779 configure-coreutils
bash 440,767,942 69,779 configure-coreutils
osh-native 748,361,077 69,779 configure-coreutils
osh-nosouffle 837,513,324 69,779 configure-coreutils
bash 22,799,636 2,029 configure-helper.sh
osh-native 25,981,336 2,029 configure-helper.sh
osh-nosouffle 30,259,518 2,029 configure-helper.sh
dash 4,811,799 1,733 functions
bash 15,312,098 1,733 functions
osh-native 24,466,682 1,733 functions
osh-nosouffle 28,856,123 1,733 functions
dash 24,904,718 9,661 ltmain.sh
bash 80,310,064 9,661 ltmain.sh
osh-native 96,267,982 9,661 ltmain.sh
osh-nosouffle 112,478,140 9,661 ltmain.sh
dash 3,294,377 1,679 t4014-format-patch.sh
osh-native 10,060,966 1,679 t4014-format-patch.sh
osh-nosouffle 11,035,902 1,679 t4014-format-patch.sh
bash 11,082,677 1,679 t4014-format-patch.sh
dash 4,585,030 3,123 t9300-fast-import.sh
osh-native 11,865,401 3,123 t9300-fast-import.sh
osh-nosouffle 13,015,730 3,123 t9300-fast-import.sh
bash 16,659,503 3,123 t9300-fast-import.sh
bash 73,195,614 5,160 test-cmd-util.sh
osh-native 96,171,397 5,160 test-cmd-util.sh
osh-nosouffle 112,278,602 5,160 test-cmd-util.sh

Shell and Host Details

shell label shell id
bash bash-36833674
dash dash-cea41b3e
osh-cpython osh-f7a66e38
osh-native osh-429e1643
osh-nosouffle osh-nosouffle-92dc422c
host label host id
no-host no-host-9c670df1

Raw Data

filename
no-host.2025-12-01__00-08-51.cachegrind.tsv
no-host.2025-12-01__00-08-51.times.csv