udem-dlteam / pnut

🥜 A Self-Compiling C Transpiler Targeting Human-Readable POSIX Shell
https://pnut.sh
BSD 2-Clause "Simplified" License
425 stars 14 forks source link

Laurent/pnut optimize constant params #5

Closed laurenthuberdeau closed 7 months ago

laurenthuberdeau commented 7 months ago

Brings the constant parameter that already exists in six-cc.scm in pnut.c. With it, the execution time is reduced by 33%.

## Optimized

ksh   12.18s user 0.21s system 99% cpu 12.470 total
dash  18.07s user 2.24s system 98% cpu 20.560 total
bash  35.17s user 0.45s system 99% cpu 35.848 total
zsh   231.86s user 9.54s system 99% cpu 4:02.96 total

## Unoptimized

ksh   18.52s user 0.21s system 99% cpu 18.808 total
dash  25.82s user 3.32s system 99% cpu 29.317 total
bash  53.41s user 0.45s system 99% cpu 54.252 total
zsh   320.60s user 13.88s system 99% cpu 5:36.43 total