The problem is the same with others langages.
You think C++ is better than Java because we have no garbage collector to handle ? If i code in C++ using
delete everywhere, i can assure you that my code will be slower than your Java code, GC cycle included.
Creating object is slow, this is just by far the slowest thing you can do in your code. Even creating a simple class with no member is slow.
So, what is the solution ? Well, the solution is the same for every languages: create all your objects during the first turns. Use caches and factories. NEVER create and delete an object after the first turn.
The only difference between Java and C++ on this point is that you can't disable the GC, so you have to take a margin on your timeout. But if you never delete any object (like we do in C++), the GC will never run.
I don't know if the problem is worse since the last update for Java. For C/C++ we have an other problem. At the first turn, we can timeout at the first turn because of the debugger (the debugger is not started in the arena). But the time used by the debugger seems to count for our execution time. And worse of all, this debugger is not able to provide any stack when we crash
But, langage update put aside, codingame changed the machine used for our codes. Maybe the new machines are just slower.