Hacker News new | ask | show | jobs
by subharmonicon 605 days ago
I’m honestly a bit surprised if that’s the first time you’ve seen something like that.

I’ve been working on compilers 30 years, primarily on optimizers (although some frontend work as well). Learned C from Borland C and C++ from…Zortech C++ 1.0, so thank you for that!

Within a few years of working on compilers I came across my first examples of 50k+ line functions. These were often (but not always) the result of source code generators that were translating some kind of problem description to code. It taught me very early on that you really need to focus on scalability and compile time in compilers, whether it’s the amount of code within a function, or across functions (for IPO / LTO).

And yes, working on compilers is never dull. 25 years ago I thought we’d end up in a monolithic world with x86, C++, and Java being the focus of all work. Instead, there’s been an absolute explosion of programming models, languages, and architectures, as well as entirely new problem spaces like graph compilers for ML.

3 comments

> Within a few years of working on compilers I came across my first examples of 50k+ line functions. These were often (but not always) the result of source code generators that were translating some kind of problem description to code.

Like the issue in the Linux kernel recently where they had some simple looking min/max macros that generated megabytes of source code.

I did see slow optimize builds before, but that was on much, much slower machines. I thought that was a thing of the past with modern CPUs.
It's not even just code. I remember once writing a script to generate a large table, only to discover that GCC took forever to compile it as it appeared to have an n^2 time in the size of the file. That can't have been the optimiser because there were no functions. I think I ended up compiling that file with TCC.
Yah, one often doesn't discover the existence of a quadratic algorithm until something like this happens.
The two scariest words in technical English are "accidentally quadratic".
Oh, I don't know about that :-) If we are looking for the two scariest words, "intermittent failure" would be my candidate.
Mine too. I can find the quadratic source, but intermittent failure can suck up all your time.
Ok, it is Halloween. How about we go with "accidentally intermittently quadratic"?

Is that scary enough for ya?