Hacker News new | ask | show | jobs
by fifilura 355 days ago
Well. History is full of good ideas executed with the wrong timing.

I am not convinced that this is not possible, just because a project from the early 2000s failed, and Knuth said it was a bad idea.

I am not talking about a general optimizer of poorly written arbitrary programs. Rather an optimizer for parts of the code written with a certain paradigm. Just like BigQuery does with SQL.

(Thank you for sticking with the thread)

1 comments

Sure, such "optimizers" exist already and are well deployed in the field but I've not seen anything that makes runtime decisions about every for loops within a program; these are developers applying their domain knowledge to say "it's important to parallelize here" and the framework has capabilities to do so efficiently because the workload can leverage it.

I'm not saying it'll never happen, but to apply it to every for loop is very different from a framework that speeds up a kind of pattern (which as I said is already a thing). The vast majority of loops don't benefit from this which is why you don't see #openmp pragmas on top of every for loop. The gains are likely minimal from doing it for every loop, you can introduce serious performance regressions when you guess wrong because you don't know about the data pattern within the loop (e.g. you introduce cache contention because the multiple threads end up writing to the same cache line), & most loops don't benefit from parallelization in the first place meaning you're doing a lot of work for no benefit. Maybe bad timing but my hunch is that I'm unlikely to see something like this in my lifetime.

FWIW, The whole thread was about ditching generic for loops...