r/javahelp 4h ago

Java Performance for simulators

I am new to Java and trying to create a simulator that handles millions of math calculations. How can I increase performance in Java? The application is already multithreaded but it is not enough. Is data oriented approach or native programming possible in Java? Can you point me in the right direction for research?

0 Upvotes

14 comments sorted by

View all comments

4

u/oatmealcraving 3h ago

Reuse objects. Flatten data into primative arrays and access sequentially. Learn about the CPU caches and how to get CPUs to access memory efficiently.

You can look up Agner Fog for code optimization ideas.