Hacker News new | ask | show | jobs
by brimpa 5422 days ago
The first commenter from the blog got it right

> Seems unhelpful to compare benchmarks where one shows the work completely optimized away.

The author doesn't offer any benchmarks of (something resembling) real code.

1 comments

It's mostly lucky (or unlucky) that the constant benchmark now optimizes away to nothing. As I mentioned in the comments (replying to that commenter), my point was to show that the overhead of constant lookup is now nearly zero, so if the values aren't used they won't be accessed. The actual work done for constants that don't disappear would be roughly equivalent to a simple memory access...very fast indeed.

I will probably do future posts with less synthetic benchmarks, but it's ultimately just hard to benchmark a specific language feature in the presence of optimizations like the JVM performs.