Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Bellard's TCC had a similar feature - it could be used to JIT scripts written in C, and libtcc was its library for dynamic code generation. Being much simpler it does nowhere near as much optimisation as GCC, but that also means it can compile much faster:

http://bellard.org/tcc/tccboot.html

TCCBOOT is only 138 KB big (uncompressed code) and it can compile and run a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4.

It'd be interesting to see someone try a similar experiment with libgccjit.



> a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4.

Hah! In 2004 (last news) maybe, and I wonder which featureset.

In fact, it's been a long time since I've compiled the kernel myself [1]. I wonder how long a minimal kernel takes to build nowadays. Of course, I guess "minimal" is even more ambiguous today than it was back then...

[1] Back in the day, "recompile your kernel" was the Linux joke answer to problems the way "try turning it off and on again" was for Windows...


On an i3 machine with plenty of RAM and an SSD, and GCC 4.9, a recent kernel builds in about 3.5 minutes. That's using the "defconfig" target, which is pretty bare-bones (only ext4, very few device drivers or fancy new features).

As another data point, Debian's kernel configuration on the same hardware takes 26 minutes to build.


One of the other benchmarks linked to on the page shows tcc compiling 10x faster than GCC 4.9 -O0 running on the RPi, and 41x faster than GCC -O3:

http://lists.nongnu.org/archive/html/tinycc-devel/2013-02/ms...

I think 3.5 minutes down to less than 15 seconds for a recent kernel is probably possible. On the other hand, tcc generates code which runs 3.5x slower, so you'd have to be doing a lot of compiling and not much running for it to save any time. JIT'ing the kernel is a fun exercise, nonetheless.


I wanted to reverse tccboot to port it to recent kernels, unfortunately it's far above my skills (far^far), I wonder if anyone attempted such a thing.


That's amazing!!!




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: