Hacker News new | ask | show | jobs
by kaba0 1403 days ago
There is an interesting presentation titled death of optimizing compilers, where it is claimed that programs increasingly are either in their hot path where performance is absolutely crucial and not even C/C++ is sufficiently low-level (you can achieve 2-3 orders of magnitude faster code by hand-optimized assembly), or on cold paths where even Bash would suffice.

Nonetheless, I found that it is easy to find these hot spots and they are trivial to “fix” in java for optimal performance, by simply using a primitive array. At every other place, Java is more than fast enough even with the occasional “jumping around”.

Also, haven’t seen a study on that but would be interested in Java’s defragmentation skills (due to moving GC). Malloc implementations can fragments a lot, and cold path code jumps around a lot. Wouldn’t be surprised if Java would fair quite well here.

1 comments

I would love to see a video game implemented in Bash with the hottest spots implemented in Assembly, just to see how poorly that would perform.

I work for a company that has AWS Lambdas which are invoked 10s of trillions of times per year, with about 45% of that happening in a single month, and another 45% happening 6 months later, also within a single month.

I cannot imagine what our AWS bill would be like if those lambdas ran Bash. 100x larger? At least.

Performance matters. It's not obvious how much it matters until you look, but it matters. There are zero users who will complain that an application makes them wait less than it did previously. There are zero managers who will complain that their AWS bill gets lower because code takes less time to run and uses less RAM.

I have no idea why anyone would even begin to argue the opposite.

I didn’t write that I agreed with said presentation, but it was interesting, and a good take away is that if you have such a scorching hot loop that iterates over megabytes of data, a compiler may not be sufficient even in low-level languages. (Think of video codecs). And the other side, routine optimizations done on cold paths may not be as worthy (the bash line was me exaggerating the effect - but just think of any Python deployment, they are basically that, slow code calling into optimized libs in C and Fortran)
I'm curious about the cost of hosting if you're using plain ol' VMs instead of lambdas (EC2, etc.). What are those functions written in? Unless you're going to say C/C++/Rust or a similar language, I'm not sure there will be any significant variance.