Skip to content

Instantly share code, notes, and snippets.

@Strykar
Created December 29, 2020 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Strykar/377ba77479e974326cb19aa894c8ee79 to your computer and use it in GitHub Desktop.
Save Strykar/377ba77479e974326cb19aa894c8ee79 to your computer and use it in GitHub Desktop.
gawk crushing busybox awk
root@apu:~# time awk 'BEGIN { OFMT = "%.0f"; for (i = 0; i < 50000; i++) print (95/100 * 42) }' > /dev/null
real 0m0.517s
user 0m0.435s
sys 0m0.081s
root@apu:~# time awk 'BEGIN { for (i = 0; i < 50000; i++) printf("%.0f\n", (95/100 * 42)) }' > /dev/null
real 0m0.862s
user 0m0.624s
sys 0m0.237s
root@apu:~# time gawk 'BEGIN { OFMT = "%.0f"; for (i = 0; i < 50000; i++) print (95/100 * 42) }' > /dev/null
real 0m0.076s
user 0m0.075s
sys 0m0.001s
root@apu:~# time gawk 'BEGIN { for (i = 0; i < 50000; i++) printf("%.0f\n", (95/100 * 42)) }' > /dev/null
real 0m0.430s
user 0m0.429s
sys 0m0.000s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment