JMonkey consums a lot of CPU

I’m using JME just for displaying a mesh without any other features of JMonkey. I don’t use audio, physic or collision dection of object but for all that the CPU usage is 11% of my application. If I decrease the frame rate from 60 to 10 then usage goes down to 5% but the picture is jerking.
I don’t make any resource consuming things. I show a mesh and the user can move it. No background, no audio, no explosions :slight_smile:

Can I disable any features to save resources? JMonkey takes also a lot time to start the engine.

How much time does it actually take to start? What are your PC specs?

Lenovo Thinkpad Laptop
CPU: i7 6700HQ 2.6 GHz
OS: Win 10 64Bit

The start up time is about 6s. But the grater problem is CPU resource consumption. In an older version of JME that wasn’t the case. But I don’t know which one anymore :frowning:

Three things I would say is:

  1. There is always an initial overhead. It is a game engine. It does “do stuff” - even on an empty scene.

  2. You say you do nothing to consume resources but we can’t know because we can’t see your code. It might be that we can find the cause if you show your code.

  3. Your IDE generally dictates how fast the game will start. The game itself does not take that long. If you run your game from the command line it will be a lot quicker. You could use another IDE but at the end of the day some things just take time. There are such thing as updating changed classes while running the game so you don’t have to keep restarting.

The application is running in an eclipse rcp app in an AwtPanel. I was hopping there’s an easy way to disable a lot of stuff I don’t need. e.g. audio.
Unfortunately, I can’t show my code.
Is a CPU usage consumption of 11% of a JME application normal?

If you run the engine on an empty scene it’s doubtful that it would consume 10% of your processor, which is why I asked to see your code.

You can disable sound by setting the sound context or whatever to null but i doubt it would even save you memory, let alone anything else.

I think the performance issue comes by the AwtPanel.

But I found no solution in this thread. Maybe there’s no one.

For what it worth, regarding start up time, Java 12 Improve out-of-the-box startup time using Class-data sharing (CDS):

1 Like

This feature sounds great but I have to use Java 8(Oracle). That’s not my decision.

I do not use eclipse, (I use netbeans) but there are many java profilers out there, I would take a look at what is actually using the CPU time in the code. It could be almost anything taking up the CPU as JME is huge and does a lot of different things depending on what features you are using, but generally, there is no overhead (or almost none) for features you are not using. I would also run a jme test scene just to check what a normal jme app uses on your system. It sounds like you are running jme inside of another app, in that case, you will have the overhead of your application as well.

1 Like

To add on to what @tlf30 said, I’d suggest you profile your application with jVisualVM (now GraalVisualVM). It’s extremely fast and easy to see where (I.e., exactly which methods) the CPU time is being spent.

10-11% CPU usage is definitely not normal in the circumstances you’re describing - on a quad core hyper threaded processor (like an i7) that means that one physical thread is fully saturated all the time. A profiler will tell you what’s going on.

1 Like