Typescript Saved My Game's Performance
Several comments came in via email, forums, and text message from friends commenting on the poor rendering performance of my game bulletz.io. The only changes I had made (from my perspective) were trivial and had nothing to do with rendering. I’d pretty much completely halted development at this point.
My laptop broke last October. Due to this I got a spankin new Macbook. I re-installed all of my dependencies. Due to some bad development practices on my part (hobby project give me a break) I bumped the version of RxJs.
Why was this problematic? well…
schedulers: Scheduler instances have changed names to be suffixed with Scheduler, (e.g. asap -> asapScheduler)
The animationFrameScheduler was moved and I didn’t notice. This was how I was controlling my rendering time. I was basically rendering all the time eating users’ CPU cycles.
For fun I refactored bulletz.io to be written in Typescript.
To my surprise, typescript threw an exception indicating that
rxjs exported no field named
animationFrameScheduler from the location I waws importing it.
I found countless other type errors littered throughout my garbage code base during my port to poorly written typescript.
I switched to using the real animationFrameScheduler and my games performance went back to how it used to be.
Typescript saved the game’s performance.