eternaldensity / Sandcastle-Builder

xkcd: 1190: Time: The Game
Other
81 stars 66 forks source link

Performance Tuning #1367

Open LuminousLeopards opened 9 years ago

LuminousLeopards commented 9 years ago

http://imgur.com/laAyp9F

Here's a CPU profile. You can see that the great majority of the processor load happens on the mNP tick. What I am wondering is whether it would be feasible to move some of the CPU-intensive calculations to a new function that runs opposite Molpy.Think/Molpy.Draw. That would spread out the computational load so those peaks aren't so high. Obviously Molpy.Draw itself would have to run on the mNP tick but I don't see a reason some of the background information can't be pre-calculated and stored between ticks.

I noticed some time ago that Molpy.getScrolLoc and Molpy.setScrollLoc are very processor-intensive but I have had them disabled for a couple weeks and have tested with different layouts and in classic, and haven't seen anything break. I'm not entirely clear what they're supposed to do, actually.

Another thing to keep in mind is to add Molpy.Anything = 1 within functions wherever possible. That will prevent it from getting called 30 times per second.

pickten commented 9 years ago

I think scrolLocs handle all the autoscroll stuff, but I'm not sure. This is something we should try to do, though.

LuminousLeopards commented 9 years ago

That makes sense. So at the least those should only be called in Stats view. The autoscroll was added before the buttons at the bottom of the log, and in light of those I don't know how necessary the autoscroll is given how resource-intensive it is. Does anybody object to taking it out?

EPSIL0N commented 9 years ago

I don't think I make use of the autoscroll.

pickten commented 8 years ago

Now clicking buttons scrolls you to the top of the page. Could this be what that function tried to resolve?