Corona doesn't use all of the available resources on PC

Hi everybody. I have a question that is more like a curiosity than a problem.

I wrote an algorithm that uses a recursive function to analitically solve my game’s levels (it’s a sort of puzzle game) in order to see if there’s any better solution than the one I thought of when I made the level.

This algorithm is heavy, as it tries to calculate any possible sequence of moves from the player,  and for some levels it can take a few seconds to complete; during this time the program does not respond on windows.

This is not a problem as I made it just for myself and I have no need to speed it up.

But when I saw it working, I noticed that even if the program is doing heavy work to solve the problem and it’s stuck on it, it uses only a very small portion of my PC’s resources. For small portion I mean around 10% of CPU and just around 30MB of RAM.

Why does it do it? Shouldn’t it use all the available resources to solve the problem as fast as it can?

Corona is not multi-threaded.  So, if you’ve got a multi-core system  with or without hyperthreading (assuming you have an Intel CPU), you will see exactly what you described.

i.e. One Logical CPU is pegged, but your total CPU usage is only a fraction of 100%

You can get a better view of CPU usage by doing this:

  1. Open Task Manager and be sure you have the full view (not summary)

  2. Go to ‘performance’ tab

  3. Select CPU (from left column)

  4. Right click the CPU graph on right and choose: Change graph to -> logical processors.

Now when you run Corona you should see one of those CPUs mostly pegged.

Hi,

AFAIK, although Corona work fine on desktop devices, it is built and optimized for mobil devices.

It is single-threaded so it cannot fully take advantage of modern multi-threaded CPUs. However, a single thread modern CPU is still very fast, so it should get the job done in good time, easily.

I’ve never hit a point where my PC CPU is the bottleneck, so I’m a little surprised your app needs several seconds pure CPU power for that calculation. Must be something else going on. I’d check the different routines in your code to see if perhaps they can be optimized logically.

As for RAM usage, Corona is just that efficient and don’t need more (depending on your app of course).

Thanks for your answers.

I didn’t know about the single threaded thing; but now that I think about it, it’s logical. As Corona is a game engine, it’s not made to solve complex CPU tasks.

I actually didn’t expect the program to run fast (it actually run faster than I thought), but I just was surprised when I saw the CPU not weighted.

Corona is not multi-threaded.  So, if you’ve got a multi-core system  with or without hyperthreading (assuming you have an Intel CPU), you will see exactly what you described.

i.e. One Logical CPU is pegged, but your total CPU usage is only a fraction of 100%

You can get a better view of CPU usage by doing this:

  1. Open Task Manager and be sure you have the full view (not summary)

  2. Go to ‘performance’ tab

  3. Select CPU (from left column)

  4. Right click the CPU graph on right and choose: Change graph to -> logical processors.

Now when you run Corona you should see one of those CPUs mostly pegged.

Hi,

AFAIK, although Corona work fine on desktop devices, it is built and optimized for mobil devices.

It is single-threaded so it cannot fully take advantage of modern multi-threaded CPUs. However, a single thread modern CPU is still very fast, so it should get the job done in good time, easily.

I’ve never hit a point where my PC CPU is the bottleneck, so I’m a little surprised your app needs several seconds pure CPU power for that calculation. Must be something else going on. I’d check the different routines in your code to see if perhaps they can be optimized logically.

As for RAM usage, Corona is just that efficient and don’t need more (depending on your app of course).

Thanks for your answers.

I didn’t know about the single threaded thing; but now that I think about it, it’s logical. As Corona is a game engine, it’s not made to solve complex CPU tasks.

I actually didn’t expect the program to run fast (it actually run faster than I thought), but I just was surprised when I saw the CPU not weighted.