egofree
|
|
Posted on: June 25, 2013, 11:00:37 am |
|
|
Joined: Jun 2013
Posts: 601
|
As i am developing a game, i am trying to optimize the code. I did some tests, but i found that even with the most simple project possible (one sprite, one object, a room with one object, no code, no special events) the CPU use is 13 % ! As i use a rather powerful computer with an Intel Core i7 CPU and with 16 GB of memory this seems to me a little bit overkill. I tried the same project with GM 8.1 and the CPU use is not significant. What do you think ?
|
|
« Last Edit: June 25, 2013, 11:06:19 am by egofree »
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #1 Posted on: June 25, 2013, 11:09:03 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
What's your GL support look like? It's possible something is being done software side which should not be. Also, what is the room speed of your game? High room speeds mean high CPU usage, just by virtue of doing something many times per second.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Goombert
|
|
Reply #3 Posted on: June 25, 2013, 12:14:34 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
egofree, theres a reason for that, we don't have DirectX ^_^
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #4 Posted on: June 25, 2013, 12:53:50 pm |
|
|
Joined: Jun 2013
Posts: 601
|
egofree, theres a reason for that, we don't have DirectX ^_^
Yes, i know there is no DirectX on linux . But still a lot users are using Windows, and i am afraid that if you need a powerful computer on Windows to run ENIGMA games, it will hinder its success I am still using Windows because it's convenient if you want to run mainstream games, but i hate the new Windows 8 with Modern UI and i really hope linux will get more and more success in the future.
|
|
« Last Edit: June 25, 2013, 12:56:14 pm by egofree »
|
Logged
|
|
|
|
TheExDeus
|
|
Reply #5 Posted on: June 25, 2013, 01:27:10 pm |
|
|
Joined: Apr 2008
Posts: 1860
|
Empty games usually use more CPU. Just like the most intensive part of SC2 was the menu (where there was a sphere rendered). The same here. Your GPU has nothing to do so the CPU boost to the max. It shouldn't really happen at 30FPS though. I previously found a problem that having the room_speed set over the max CPU/GPU can handle, then CPU will spike to 100% (for the one core it runs on), you lower the FPS by 1 (like 61 to 60) and it falls to 0%. We need a more intelligent system which would run in the background and monitor and change the performance. Although VSYNC and adaptive vsync (which we should implement, it's the same function like we have now, but with -1 set instead) it usually doesn't happen.
And I just tested with one animated sprite with one object and in one room with default 30fps. I get 0-1% CPU load. I also have i7, 16gigs of RAM and 660TI. So it could be something else on your side. Is something else using the CPU? As I said, it seems to use a lot of CPU when it can't catch up. So if you can't easily render 30FPS because of some massive processes, then the game could just up in CPU usage. It seems like a devilish circle, but for now I don't know what can be changed. For me that happens when I render over 300FPS (or more) in the 1mil cube demo.
edit: Also I though we had a memory leak because ram usage kept increasing from about 18mb on startup to about 20mb after about 1 minute. Then it stabilized though. I don't think we cache anything so it seems weird.
|
|
« Last Edit: June 25, 2013, 01:28:47 pm by TheExDeus »
|
Logged
|
|
|
|
|
|
|
|
|
|
TheExDeus
|
|
Reply #12 Posted on: July 03, 2013, 02:31:59 pm |
|
|
Joined: Apr 2008
Posts: 1860
|
Well anything is possible, but CPU load shouldn't be changed by the graphics system. Maybe some more detailed profiling is possible to see what exactly the game is doing on the CPU. Looking at this thread http://social.msdn.microsoft.com/Forums/vstudio/en-US/ef38c900-f2e2-4ae7-8e03-2a3941805aa3/profiling-what-code-causes-high-cpu-usage even the most basic timer profiling could do the trick. You could check which function executes the longest and thus see why it shows that CPU usage at 13%. In that case it is possible that the some GL function (like GL swap buffers or something) cause a stall which takes a larger amount of time and thus shows up as higher CPU usage (while in reality CPU was just waiting). Try turning off the background in room, if that doesn't show anything then set automatic redrawing to false. I don't think "Sleep on minimize" thing is implemented, but if it is then try that as well.
|
|
« Last Edit: July 03, 2013, 02:34:49 pm by TheExDeus »
|
Logged
|
|
|
|
Goombert
|
|
Reply #13 Posted on: July 03, 2013, 03:05:07 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Harri, forthevins update timer takes into account wherever you are rendering things or not, and tries to pick a suitable CPU usage.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|