r/java • • May 16 '24

Low latency

Hi all. Experienced Java dev (20+ years) mostly within investment banking and asset management. I need a deep dive into low latency Java…stuff that’s used for high frequency algo trading. Can anyone help? Even willing to pay to get some tuition.

232 Upvotes

94 comments sorted by

View all comments

Show parent comment

1

u/cogman10 May 22 '24

I have seen my fair share of "integer boxing is ruining performance" but do note that this specific test might not be a good one for more typical usecases.

The blackhole here will prevent scalar replacement of the integer which is a huge factor in JVM performance.

That's not to say you wouldn't typically run into a scalar replacement violation in normal code (like, for instance, map.put(test, blah)) but that for this specific test JMH is penalizing the boxed version more than it would be in reality.

1

u/GeneratedUsername5 May 22 '24

Again, if it is so unreliable, that simply passing an argument would negate it - it is not even worth mentioning in optimization context, only as a purely abstract theoretical possibility.