News for hackers. Stuff that matters.
Re:Choosing Java instead of C++ for low-latency systems by SlipperySlope on Monday February 22, 2021 @11:23AM (#26226303)
Java can be written with no garbage collection. 1. Pool the business objects and create them all ahead of time. Restore them to the pool after a thread uses them.

2. Create a String pool and use == for equality checks.

3. Avoid Java constructs that create temporary iterators.

for (i = 1, size=myList.size(); i<size; i++)

creates no iterator whereas

for (Object obj : myList)

does. You employ a profiling tool to find the garbage-creating sections of Java code and rewrite them.

I know of a wall street trade matching engine that operates with no pauses for garbage collection that uses these techniques.

There are no comments on this comment yet.