3 ms·
Java Beats C++ in Battle for High-Speed Trading Systems
- SlipperySlope 6y agoJava can be written to not create any garbage objects whatsoever. First allocate sufficient objects in named pools by type and explicitly initialize and reclaim them. Second do not use Java expressions that allocate iterator objects such as for(String myString : myStrings). Local block scope objects are allocated efficiently from the stack. In Java, a custom String pool can be created that allows == comparisons instead of equals() comparisons. Java threads can be pinned to physical cores and spin locks used to waste CPU while awaiting requests. The local CPU cache stays hot and ready.