I believe Java suffers from not having value-type structs. We cannot pass a coordinate, nor return one, without allocating it on the heap. There are millions of allocations being done while rendering, which must unnecessarily slow down the process.
Consider the following options:
- Keep using Java only. Try to profile the program and find out whether it is possible to optimize.
- Re-write the rendering logic in Rust. The Java part of the program shall deal with input and preprocessing, and delegate the heavy lifting to the Rust program.
- Re-write the complete program in Rust.