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.2

(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 3,340
bash 118,863 463
osh-native 118,863 287
osh-cpython 118,863 11

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 7 3 3 3 2,698 Build.sh
osh-native 11 7 4 8 2,698 Build.sh
osh-cpython 309 285 24 20 2,698 Build.sh
dash 2 2 0 2 2,512 abuild
bash 8 8 0 3 2,512 abuild
osh-native 12 12 0 9 2,512 abuild
osh-cpython 424 398 25 21 2,512 abuild
dash 7 6 0 2 20,489 configure
bash 49 49 0 4 20,489 configure
osh-native 74 62 12 21 20,489 configure
osh-cpython 2,361 2,320 40 42 20,489 configure
dash 16 12 4 2 69,779 configure-coreutils
bash 121 121 0 3 69,779 configure-coreutils
osh-native 239 219 20 50 69,779 configure-coreutils
osh-cpython 5,250 5,144 104 86 69,779 configure-coreutils
bash 8 8 0 3 2,029 configure-helper.sh
osh-native 9 6 3 8 2,029 configure-helper.sh
osh-cpython 311 286 25 20 2,029 configure-helper.sh
dash 2 2 0 2 1,733 functions
bash 6 3 3 3 1,733 functions
osh-native 9 6 3 8 1,733 functions
osh-cpython 241 220 20 20 1,733 functions
dash 3 3 0 2 9,661 ltmain.sh
bash 25 21 4 4 9,661 ltmain.sh
osh-native 26 21 4 15 9,661 ltmain.sh
osh-cpython 1,097 1,051 45 28 9,661 ltmain.sh
dash 1 1 0 2 1,679 t4014-format-patch.sh
bash 5 5 0 3 1,679 t4014-format-patch.sh
osh-native 5 3 3 7 1,679 t4014-format-patch.sh
osh-cpython 77 67 9 18 1,679 t4014-format-patch.sh
dash 1 1 0 2 3,123 t9300-fast-import.sh
osh-native 5 0 5 8 3,123 t9300-fast-import.sh
bash 7 7 0 3 3,123 t9300-fast-import.sh
osh-cpython 123 99 23 18 3,123 t9300-fast-import.sh
bash 22 22 0 3 5,160 test-cmd-util.sh
osh-native 24 16 8 12 5,160 test-cmd-util.sh
osh-cpython 990 949 41 27 5,160 test-cmd-util.sh

Instruction Counts

shell label irefs num lines filename
dash 6,417,905 2,698 Build.sh
bash 35,933,919 2,698 Build.sh
osh-native 37,967,896 2,698 Build.sh
dash 7,043,427 2,512 abuild
bash 43,752,445 2,512 abuild
osh-native 45,850,326 2,512 abuild
dash 53,264,106 20,489 configure
osh-native 279,244,650 20,489 configure
bash 349,528,134 20,489 configure
dash 151,775,776 69,779 configure-coreutils
bash 886,051,458 69,779 configure-coreutils
osh-native 889,927,686 69,779 configure-coreutils
osh-native 31,047,210 2,029 configure-helper.sh
bash 47,119,656 2,029 configure-helper.sh
dash 4,654,611 1,733 functions
bash 28,153,410 1,733 functions
osh-native 29,316,712 1,733 functions
dash 23,598,849 9,661 ltmain.sh
osh-native 114,687,549 9,661 ltmain.sh
bash 172,845,801 9,661 ltmain.sh
dash 3,168,267 1,679 t4014-format-patch.sh
osh-native 11,984,964 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 14,091,212 3,123 t9300-fast-import.sh
bash 41,145,971 3,123 t9300-fast-import.sh
osh-native 113,939,812 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-4bb15826
dash dash-308ec8e6
osh-cpython osh-3886102a
osh-native osh-790234ee
host label host id
no-host no-host-72fea418

Raw Data

filename
no-host.2024-09-11__17-38-57.cachegrind.tsv
no-host.2024-09-11__17-38-57.times.csv