sllarck Posted August 18, 2018 Share Posted August 18, 2018 I have a performance problem in my game, at the start of game it's all good but when i play for couple of minutes the game starts getting lags and getting slow and slower... I checked out the google chrome profiling And found this: at the start of game sortByDepth is using around 5% but then it starts getting higher and higher after couple of minutes it even reaches 60-70%! I removed all the setDepth() from my code but nothing really changed. So I kinda know which part of code is causing this problem (pretty big part) but i can't understand why this happens so i can't find a solution. what could be the problem with sortByDepth ?? Link to comment Share on other sites More sharing options...
samme Posted August 19, 2018 Share Posted August 19, 2018 Use the Bottom-Up view and expand from sortByDepth. Link to comment Share on other sites More sharing options...
sllarck Posted August 19, 2018 Author Share Posted August 19, 2018 16 hours ago, samme said: Use the Bottom-Up view and expand from sortByDepth. here: Link to comment Share on other sites More sharing options...
Antriel Posted August 20, 2018 Share Posted August 20, 2018 That sounds like a memory leak of some kind. I assume you are removing a lot of game objects and adding new ones. Can you check if `this.children.list.length` keeps increasing or not? If yes, how are you destroying children? Try to make a small reproducible demo if possible. sllarck 1 Link to comment Share on other sites More sharing options...
sllarck Posted August 20, 2018 Author Share Posted August 20, 2018 4 hours ago, Antriel said: That sounds like a memory leak of some kind. I assume you are removing a lot of game objects and adding new ones. Can you check if `this.children.list.length` keeps increasing or not? If yes, how are you destroying children? Try to make a small reproducible demo if possible. You are right, I had a graphic object and I needed to change it's width all the time so this is what I was doing: I added the graphic object in create() and as stupid as it sounds instead of just changing it's width, I was doing clear() fillRect() in update :)) I was just looking for the problem in a wrong place. Link to comment Share on other sites More sharing options...
Recommended Posts