Thursday, January 20, 2011

bloated C compilers

I've been testing Irken out on my netbook (a Samsung NC10), and discovered a big problem with feeding Irken's output to gcc.

When I tried to compile the self-hosted Irken with -O, the netbook fell on its knees.  After about 15 minutes, I decided to look into it... why hadn't the compile finished yet?

The input Irken source was about 60kB, which exploded into a 920kB C file.  The C output is actually pretty low-level stuff, so it's probably comparable to a 300kB hand-written C file.  But let's just call it 1MB and move on...

The gcc (version 4.4) process had eaten 1.4GB of virtual memory, so it was paging on the netbook.

That's 1600X the size of the C input file.  It's nearly 25,000X the size of the Irken input.  Wow.

So as a test I installed dragonegg and gcc-4.5.  Quite a difference.  The dragonegg compile held at 143MB for most of the compile, and peaked at around 200MB.  Only 226X the size of the C input, and a mere 3400X the size of the Irken input.

But what's an order of magnitude between friends?

No comments:

Post a Comment