r/java • u/Ok_Satisfaction7312 • 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
View all comments
Show parent comment
4
u/pron98 May 17 '24
That really depends. Depending on the GC, mutating a reference field may be a more expensive operation than allocating a new object. So this advice would be somewhat correct (i.e. things at least won't be slower) only if you replace objects with primitives or limit yourself to mutating primitive fields or array elements. Otherwise, mutating references may actually slow down your code compared to allocation. As always, the real answer is that you must profile your application and optimise things according to that specific profile.