1

I have a java project running jMonkey Engine. On my normal laptop (not the greatest laptop there is) my project runs fine. But on my high-end gaming pc (GeForce GTX 970, Intel i5-6600K @3.50 GHz, 16 GB RAM) the program lags. Like every 2 seconds my engine just freezes for a couple ms which causes huge lags. I am using this java (recently updated it to see if that would fix it)

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Mickael
  • 3,506
  • 1
  • 21
  • 33
Enforcerke
  • 257
  • 1
  • 3
  • 10
  • @NitinPrabhu but it's so strange knowing my PC is 20 times better than my laptop? Both running the same java, same operating system and same IDE – Enforcerke May 22 '17 at 11:59
  • I think you need to see which all threads/processes are eating up the memory and CPU in your PC. – Nitin Prabhu May 22 '17 at 12:02
  • 1
    Disk type? As said: eclipse.ini and JVM heap size. I have seen for example that using SVN with eclipse can slow down everything. So when you are using different SCM connections ... – GhostCat May 22 '17 at 12:02
  • @GhostCat both my eclipse and java are on my SSD disk. – Enforcerke May 22 '17 at 12:13
  • Well, then, when you are really curious, you might want to start profiling your eclipse. Your ask within the eclipse community. – GhostCat May 22 '17 at 12:15
  • 1
    @duffymo I got the same problem with IntelliJ – Enforcerke May 22 '17 at 12:28
  • @GhostCat Problem isn't located in my Eclipse, got the same for IntelliJ – Enforcerke May 22 '17 at 12:28
  • If the program you developed with an IDE or editor lags, it's rarely the fault of the IDE. Basic knowledge of application and process management in the OS allows to understand that your issue is in no way related to Eclipse IDE. – Mickael May 23 '17 at 08:47
  • Does a very simple project (i.e. one cube) also run slowly? – Steve Smith Jul 18 '17 at 08:36

1 Answers1

3

From your description it is very hard to answer this question. You might want to try the JME forums where a more discussion and troubleshooting approach is possible than here.

The only thing I can think of that might explain what you are seeing is that you are generating a lot of garbage. On a PC with more memory then it can build up a lot of garbage then do a long pause to collect it all. On the lower spec PC it is forced to run the GC more often which means the GC pauses are too small to notice.

The engine has been carefully written not to generate much garbage in general use, so you should look at what you are generating each frame. Try attaching a Profiler (there are some decent ones provided with the JDK such as jConsole) and looking at whether there is a large GC linked to the pauses.

Tim B
  • 40,716
  • 16
  • 83
  • 128
  • That was it, i limited the FPS of the engine so i would have less GC, also reviewed my code to reduce GC. Works like a charm now! – Enforcerke May 25 '17 at 14:26
  • 1
    Yeah, you aren't the first person to run into that counter-intuitive result :) – Tim B May 25 '17 at 15:34