Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Memory usage linked to CPU drain? — Gideros Forum

Memory usage linked to CPU drain?

totebototebo Member
edited October 2014 in Bugs and issues
Hey,

I'm troubleshooting an issue originating when loading a large chunk of text.

Scenario 1: Load 1 file. Memory 490kB, 60 FPS
Scenario 2: Load 100 files. Memory 3979kB, 58 FPS
Scenario 3: Load 1000 files. Memory 35400kB, 49 FPS

The FPS drop happens even if I don't touch the table I loaded the text into. When I measure the FPS the game is effectively on standby. Is there a link between memory usage and FPS?

Cheers,

Niclas


My Gideros games: www.totebo.com

Comments

  • totebototebo Member
    edited October 2014
    Further tests reveals that the bottleneck in this case seems to be loadfile();

    When I use loadfile() to load all 1,000 files I get 49 FPS.
    When I load only one file with loadfile(), and duplicate it 1,000 times by code, the FPS stays at 60.

    Digging deeper, will update this thread.
    My Gideros games: www.totebo.com
  • piepie Member
    @totebo Does fps increase if you load each file with a small delay? ( timer.delayedcall (10*#file, loadfile)
    I got some improvements applying this "trick" :)
  • Hi @pie, thanks for the reply! I tried this out and it doesn't seem to make any difference. I load all files in one go, so afterwards I expect CPU to recover. But something must be lingering...
    My Gideros games: www.totebo.com
  • So I've concluded that using memory does affect CPU; the more memory I use, the slower the app gets. The solution in my case is to load each file only once and re-use it if needed. Thank you for reading. :)
    My Gideros games: www.totebo.com
  • piepie Member
    @totebo maybe you're right, something should be lingering..I admit I never loaded so many files in a row, but it seems strange that memory remains busy. I suppose that you already call garbagecollector at the end of your file loading. Any difference in the _G table before/after?
    Bhleaky (check on this forum) is a good trick. :)
    Also check this out about gc :)
    http://lua-users.org/wiki/OptimisingGarbageCollection

    Good luck! :)
Sign In or Register to comment.