efficiency problem.

I found that before. Every time I run a simple orx program in my MacBook for a little time, Its fan begin running.(I think you know what it means)

Again, I begin to use Orx in Windows。When I run a very simple orx program even just with a empty window,It keep costing 50% CPU......That's a big problem.

And after someone told me about this problem again in my blog, I think I should let you know this problem.

Maybe something wrong when Orx keep running with sleep.I saw the sleep code, but not sure it run correct. I write similar code before, I think the code there is too complex so.

And sometime, I get a orx window and can't close it.Even I can't kill it with the task manager.

It keep costing 50% CPU, not just for a while. Debug and release version is the same. That's a very big problem.If it have this problem, I'm afraid how long the IPhone could run a Orx program......
btw,I use orx 1.1.

Comments

  • edited April 2012
    This behavior can have 2 different causes:

    - Either you're not using VSync and orx will run as fast as it can, often rendering hundreds or thousands of frames

    - Using the internal MainClockFrequency, as orx will poll as often as possible to be as precise as it can for clocks update. (And, as we spoke, I know it was your case).

    I'll make a change so that using MainClockFrequency won't give such results in the future, that'll be released with 1.2 too. :)

    In most case people might want to only use VSync without defining MainClockFrequency so that they won't experience tearing.
    As you know, MainClockFrequency is only useful when VSync can't be supported or when the game code is too costly to be executed once per rendered frame.
  • edited June 2010
    iarwain wrote:
    I'll make a change so that using MainClockFrequency won't give such results in the future, that'll be released with 1.2 too. :)

    Done and available from the svn version! :)
  • edited June 2010
    what a hard working man you are.....
  • edited June 2010
    There another efficiency problem exist in IPhone/IPad version Orx. I tested the orx in the SVN.The orxTest(the only iphone demo of orx) keep on costing 86~95 CPU in my MacBook in debug.

    This is a very big problem too.
    I talked about the orx in the svn.......

    And there is another interesting problem too.When I run the orxTest with IPod/IPHone Simulator It works right.But when I run the orxTest with IPad/IPad Simulator It always get a init touch in the original position.(the center of the screen)
    I don't know what happen between IPhone and IPad.But I think this may be a init bug.
  • edited June 2010
    BTW:I found the mushroomstew keep on costing 50% CPU in my MacBook.I think all the things pointer the Orx's efficiency need to improve.

    BTW's BTW: I don't know when orx changed to SDL if it could be get how better.But it's obvious not good with SFML.Even with OpenGL ES.(IPhone part)
  • edited June 2010
    jtianling wrote:
    And there is another interesting problem too.When I run the orxTest with IPod/IPHone Simulator It works right.But when I run the orxTest with IPad/IPad Simulator It always get a init touch in the original position.(the center of the screen)
    I don't know what happen between IPhone and IPad.But I think this may be a init bug.


    Interesting for the first touch in iPad. I'll have a look, but there's no init about that. I only forward event sent from the SDK.
  • edited June 2010
    jtianling wrote:
    BTW:I found the mushroomstew keep on costing 50% CPU in my MacBook.I think all the things pointer the Orx's efficiency need to improve.

    BTW's BTW: I don't know when orx changed to SDL if it could be get how better.But it's obvious not good with SFML.Even with OpenGL ES.(IPhone part)

    How many FPS are displayed on your mac? I'll just launched Mushroom Stew on my PC, in the biggest levels it takes between 3 and 6% of CPU here. The highest peak was 8%. It ran consistently at 60FPS with no trouble.

    I'll try on my macbook to see what results I get.
  • edited June 2010
    I've just tried Mushroom Stew on my 2 years old macbook and it eats up to 28% of the CPU.
    97.25% of this time is spent in rendering:
    - 80% of which is SFML's swap for rendering
    - 20% of which are the SFML primitives called for rendering an object

    The game also runs at a constant 60FPS with any trouble and pixel shaders activated.
  • edited June 2010
    iarwain wrote:
    I've just tried Mushroom Stew on my 2 years old macbook and it eats up to 28% of the CPU.
    97.25% of this time is spent in rendering:
    - 80% of which is SFML's swap for rendering
    - 20% of which are the SFML primitives called for rendering an object

    The game also runs at a constant 60FPS with any trouble and pixel shaders activated.

    I don't know why we get the different results.
    It keep on cost 50% of the CPU in my new MacBook.
    And I changed nothing about the mushroom Stew and just run It.

    FPS could keep on being 60.
  • edited June 2010
    jtianling wrote:
    There another efficiency problem exist in IPhone/IPad version Orx. I tested the orx in the SVN.The orxTest(the only iphone demo of orx) keep on costing 86~95 CPU in my MacBook in debug.

    This is a very big problem too.
    I talked about the orx in the svn.......

    This is the biggest problem. svn version even can't be bearable to run orxTest.
  • edited June 2010
    jtianling wrote:
    jtianling wrote:
    There another efficiency problem exist in IPhone/IPad version Orx. I tested the orx in the SVN.The orxTest(the only iphone demo of orx) keep on costing 86~95 CPU in my MacBook in debug.

    This is a very big problem too.
    I talked about the orx in the svn.......

    This is the biggest problem. svn version even can't be bearable to run orxTest.

    I'm not sure I understand your sentence. What do you mean?
  • edited June 2010
    iarwain wrote:
    jtianling wrote:
    jtianling wrote:
    There another efficiency problem exist in IPhone/IPad version Orx. I tested the orx in the SVN.The orxTest(the only iphone demo of orx) keep on costing 86~95 CPU in my MacBook in debug.

    This is a very big problem too.
    I talked about the orx in the svn.......

    This is the biggest problem. svn version even can't be bearable to run orxTest.

    I'm not sure I understand your sentence. What do you mean?

    I talked about the problem in
    Re:when orx support ipad?
    https://forum.orx-project.org/discussion/922&catid=12#922
  • edited June 2010
    As you can see on internet (by googling opengl + vsync + CPU), this is a very well known issue.
    Different implementation of OpenGL, depending on drivers, will eat CPU time waiting for VSync or not.

    It looks bad when you look at the graph, but it doesn't mean much as the process is just sitting around waiting for VSync. This means that the game won't lag or slow down if you do more processing, it will just wait less for the VSync and the CPU usage won't move.

    If you really want to lower down your CPU usage, you can deactivate VSync and use the MainClockFrequency config parameter. By doing so, orx will yield after every frame. The drawback being that yielding using sleep isn't accurate at all (on some OSes the precision can be at bad as ~12ms). That means, when you will be doing more game processing on your side, your FPS might become unstable.
    The other obvious drawback of not using VSync being that tearing might appear. However this issue can be hard to notice with monitors using frequencies of 60Hz+. Most of the big AAA games come with VSync deactivated by default anyway.

    So here you go, your choice, on computer, is either to use VSync and on some configurations (ie. combination of hardware/OS/driver) CPU usage might raise pretty fast, just waiting for VSync, but that doesn't mean the game will slow down or that CPU usage will go higher when you do more intensive processing or you deactivate VSync and you limit the MainClockFrequency to prevent from calculating hundreds or thousands of frames per second. In this case, the CPU usage will lower but you might experience tearing and FPS instability.

    To sum it up, it's not orx eating CPU cycles like crazy, it's just OpenGL sitting and waiting for the VSync that gives these results. This is a very common issue as you can see here, for example: http://www.retrocopy.com/blog/5/the-battle-of-v-sync-opengl-on-nvidia-vs-ati.aspx

    PS: For iPhone/iPad, as we can't control the VSync afaik, I'd suggest using MainClockFrequency or you'll be eating up CPU cycles for real, this time. :)
  • edited June 2010
    OK, I knew that was what the exactly we did.We never used vsync before.
Sign In or Register to comment.