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.1
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 2,864
bash 118,863 540
osh-native-souffle 118,863 459
osh-native 118,863 432
osh-cpython 118,863 15

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 4 4 0 3 2,698 Build.sh
osh-native-souffle 6 6 0 8 2,698 Build.sh
osh-native 7 3 3 8 2,698 Build.sh
osh-cpython 219 199 20 22 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 8 4 4 9 2,512 abuild
osh-cpython 286 269 16 23 2,512 abuild
dash 10 7 3 2 20,489 configure
osh-native-souffle 41 33 8 20 20,489 configure
osh-native 43 35 8 21 20,489 configure
bash 48 48 0 4 20,489 configure
osh-cpython 1,379 1,338 40 43 20,489 configure
dash 19 19 0 2 69,779 configure-coreutils
bash 115 115 0 3 69,779 configure-coreutils
osh-native-souffle 156 140 16 49 69,779 configure-coreutils
osh-native 164 144 20 50 69,779 configure-coreutils
osh-cpython 4,303 4,218 84 87 69,779 configure-coreutils
bash 4 4 0 3 2,029 configure-helper.sh
osh-native-souffle 5 5 0 8 2,029 configure-helper.sh
osh-native 6 6 0 8 2,029 configure-helper.sh
osh-cpython 210 198 12 21 2,029 configure-helper.sh
dash 2 2 0 2 1,733 functions
bash 3 3 0 3 1,733 functions
osh-native-souffle 5 0 5 8 1,733 functions
osh-native 6 6 0 8 1,733 functions
osh-cpython 204 187 16 21 1,733 functions
dash 3 3 0 2 9,661 ltmain.sh
osh-native-souffle 17 13 4 15 9,661 ltmain.sh
osh-native 19 19 0 15 9,661 ltmain.sh
bash 23 23 0 4 9,661 ltmain.sh
osh-cpython 685 664 20 29 9,661 ltmain.sh
dash 1 1 0 2 1,679 t4014-format-patch.sh
bash 3 3 0 3 1,679 t4014-format-patch.sh
osh-native-souffle 3 3 0 7 1,679 t4014-format-patch.sh
osh-native 4 4 0 7 1,679 t4014-format-patch.sh
osh-cpython 88 71 16 19 1,679 t4014-format-patch.sh
dash 1 1 0 2 3,123 t9300-fast-import.sh
osh-native-souffle 4 4 0 7 3,123 t9300-fast-import.sh
osh-native 4 0 4 8 3,123 t9300-fast-import.sh
bash 4 4 0 3 3,123 t9300-fast-import.sh
osh-cpython 86 72 13 20 3,123 t9300-fast-import.sh
bash 12 12 0 3 5,160 test-cmd-util.sh
osh-native-souffle 14 0 14 12 5,160 test-cmd-util.sh
osh-native 15 15 0 12 5,160 test-cmd-util.sh
osh-cpython 597 568 28 28 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 33,015,767 2,698 Build.sh
bash 35,933,919 2,698 Build.sh
osh-native 37,654,010 2,698 Build.sh
dash 7,043,427 2,512 abuild
osh-native-souffle 38,853,176 2,512 abuild
bash 43,752,445 2,512 abuild
osh-native 45,375,551 2,512 abuild
dash 53,264,106 20,489 configure
osh-native-souffle 241,695,350 20,489 configure
osh-native 276,339,430 20,489 configure
bash 349,528,134 20,489 configure
dash 151,775,776 69,779 configure-coreutils
osh-native-souffle 782,486,479 69,779 configure-coreutils
osh-native 880,848,016 69,779 configure-coreutils
bash 886,051,458 69,779 configure-coreutils
osh-native-souffle 26,593,977 2,029 configure-helper.sh
osh-native 30,691,432 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,919,756 1,733 functions
bash 28,153,410 1,733 functions
osh-native 29,027,514 1,733 functions
dash 23,598,849 9,661 ltmain.sh
osh-native-souffle 97,480,054 9,661 ltmain.sh
osh-native 113,463,812 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,865,576 1,679 t4014-format-patch.sh
osh-native 11,915,705 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,729,318 3,123 t9300-fast-import.sh
osh-native 13,977,110 3,123 t9300-fast-import.sh
bash 41,145,971 3,123 t9300-fast-import.sh
osh-native-souffle 97,541,523 5,160 test-cmd-util.sh
osh-native 112,792,433 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-15a3d804
dash dash-0ebcf347
osh-cpython osh-a31ad41e
osh-native osh-07c76e09
osh-native-souffle osh-native-souffle-20e91026
host label host id
no-host no-host-6df8bfd3

Raw Data

filename
no-host.2025-04-16__20-33-42.cachegrind.tsv
no-host.2025-04-16__20-33-42.times.csv