tobydragon / GameShell

1 stars 1 forks source link

Generating new stageviews is slow #31

Closed DubThink closed 7 years ago

DubThink commented 7 years ago

I believe the majority of the time spent creating the stageview is generating the cards' buttons. This is probably due to image loading. Perhaps we can load images in to the individuals, and then just use the preloaded images.

DubThink commented 7 years ago

Updated to load images into individuals and use those, rather than have the button load them each time. I performed some time trials on the new stage creation code (all the code inside the if buttonResponse: statement in Controller.gameLoop() (line 59 currently)

Before: .45s After: .075s

DubThink commented 7 years ago

(Note: moved next stage code into controller.nextStage()

DubThink commented 7 years ago

profiled time of controller.nextStage(). The 2 functions of note are elf.stageView = stageView.StageView(self.stageModel, 100, 50, DISPLAYSURFACE) With 72ms +/- 1ms and self.stageView.clearDisplay() with 0.6ms +/- 0.1ms