Skip to content

Commit

Permalink
Optimise for small code by default
Browse files Browse the repository at this point in the history
My tests with running shbench[*] on ksh binaries compiled by clang
and gcc yielded no performance difference between compiling with
'-O2' and '-Os'. So we might as well reduce ksh's size and memory
footprint by default.

[*] http://fossil.0branch.com/csb/
    https://github.com/ksh-community/shbench

src/cmd/INIT/make.probe:
- Change default gcc optimisation level from -O2 to -Os.
- Change default non-gcc optimisation level from -O to -Os.
  • Loading branch information
McDutchie committed Jul 17, 2020
1 parent 3613da4 commit 37a9c34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/INIT/make.probe
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ probe_ccs="strip size nm ld ar" # longest to shortest
probe_debug="-g"
probe_dll="'-G 0' -Wc,dll,exportall,longname,rent -Wc,exportall -dynamic $cc_dll_def"
probe_export_dynamic="-rdynamic -export-dynamic -Wl,-export-dynamic -Wl,-E -bexpall -force_flat_namespace"
probe_gcc_optimize="-O2"
probe_gcc_optimize="-Os"
probe_gcc_version="*[Gg][Cc][Cc]*"
probe_include_local="'-ignore-source-dir -iquote' -iquote -I-"
probe_ldlazy='-zlazyload -znolazyload -Wl,-zlazyload -Wl,-znolazyload'
Expand All @@ -34,7 +34,7 @@ probe_lib_all_undef="-all -notall -all -none -Bwhole-archive -Bno-whole-archive
probe_lib_multiple="-Wl,-zmuldefs"
probe_libdir="shlib lib"
probe_nmflags="'' -p -B"
probe_optimize="-O"
probe_optimize="-Os"
probe_pic="-Kpic -KPIC -fpic -fPIC -pic -PIC +z +Z"
probe_no_protect="'-fno-stack-protector -fno-stack-protector-all' -GS-"
probe_readonly="-R -Krodata -xMerge -Wa,-r"
Expand Down

0 comments on commit 37a9c34

Please sign in to comment.