Hacker News new | ask | show | jobs
by hyperpape 2346 days ago
Great point. In addition to caching, there's potential for branch prediction effects.

This is why the JMH samples warn against including loops[0] of the operations you're trying to measure, and have an API that's designed to avoid the programmer having to every write their own looping code.

[0] https://hg.openjdk.java.net/code-tools/jmh/file/7bc6011260aa...

1 comments

Great point about using JMH. As of JDK 12, it’s included in the SDK: https://openjdk.java.net/jeps/230

What’s the equivalent of JMH for Python?

I'm afraid I don't know, I really don't have any particular knowledge of performance engineering in Python.
I'm not sure the JMH is meaningfully included in the JDK for others to use. The JDK happens to come with some JMH-based benchmarks in the source tree, that seems to be about it.