Friday, October 04, 2019
Back when I was a kid, all I had to worry about was the mass extinction of the human race due to global thermonuclear war
Bunny and I are out eating dinner at T. B. O. McFlynnagin's and out of the corner of my eye on one of the ubiquitious televisions dotting the place, I saw what appeared to be a “back to school” type commercial but one that turned … dark. I'm normally not one for trigger warnings, but this commercial, which did air because I saw it, is quite graphic. So … you have been warned!
It reminds me of the “Daisy” commercial, although it's hard to say which one is worse. Perhaps both of them are.
It's a stupid benchmark about compiling a million lines of code, what else did I expect?
I came across a claim that the V programming langauge can compile 1.2 million lines of code per second.
Then I found out that the code was pretty much just 1,200,000 calls to println('hello world')
.
Still,
I was interested in seeing how GCC would fare. So I coded up this:
#include <stdio.h> int main(void) { printf("Hello world!\n"); /* 1,199,998 more calls to printf() */ printf("Hello world!\n"); return 0; }
which ends up being 33M, and …
[spc]lucy:/tmp>time gcc h.c gcc: Internal error: Segmentation fault (program cc1) Please submit a full bug report. See <URL:http://bugzilla.redhat.com/bugzilla> for instructions. real 14m36.527s user 0m40.282s sys 0m17.497s [spc]lucy:/tmp>
Fourteen minutes for GCC to figure out I didn't have enough memory on the 32-bit system to compile it (and the resulting core file exceeded physical memory by three times). I then tried on a 64-bit system with a bit more memory, and I fared a bit better:
[spc]saltmine:/tmp>time gcc h.c real 7m37.555s user 2m3.000s sys 1m23.353s [spc]saltmine:/tmp>
This time I got a 12M executable in 7½ minutes, which seems a bit long to me for such a simple (but large) program. I mean, Lua was able to compile an 83M script in 6 minutes, on the same 32-bit system as above, and that was considered a bug!
But I used GCC, which does some optimizations by default. Perhaps if I try no optimization?
[spc]saltmine:/tmp>time gcc -O0 h.c real 7m6.939s user 2m2.972s sys 1m27.237s [spc]saltmine:/tmp>
Wow. A whole 30 seconds faster. Way to go, GCC! Woot!