Created
December 29, 2020 03:12
-
-
Save Strykar/377ba77479e974326cb19aa894c8ee79 to your computer and use it in GitHub Desktop.
gawk crushing busybox awk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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