New games every week!
🤡-16- Optimising! Blog
16th April 2025
Uhoh, I've fallen down the rabbit hole again!

-=-=-

I spent all day yesterday optimising JSE.
.. And breaking JSE.
And fixing JSE.
And optimising JSE.
And then breaking and fixing again, in an endless loop.

"You've been at that all day" said Mum, and I can't stress how much of a rarity it is for Mum to notice that I've been doing one particular thing, all day!!

Usually I leap about from project to project, do a little here, a little there, fix up some tweaks, bulk up a game, etc.
But, no, I pretty much spent the whole day staring at...

Optimisationalism 5



The first thing I did, was I made a new Optimisationalism. It's VERY unoptimised, for good reason.
It means that I can focus my attention on trying to bulk up the speed of the actual code logic, rather than drawing routines and such.



This is Spinal's screenshot, and I'm using this one because it's really quite good for telling what's going on. (Numbers are time taken)
The text drawing functions, the topmost section, is still the slowest. That's something I bloomin' well hate, but it's something I really can't seem to solve. We'll ignore that and come back to it later

We can see that the rest of the drawing calls are actually in a well optimised set of values. We're still not winning any awards, here, but they're all sort of averaging out at a decent level. The most optimised (I think) should be 500. Any slowness within this section is, usually, the browser not being able to keep up with all the Canvas draws.
I'd like to be able to fix this, but I'm not entirely convinced that I can.
We'll see in the future. I might attempt to switch to WebGL, but that's for another another day!

Most importantly, then, we can see the bottom-most set of figures.
These are the Maths, and this is where no draw-calls occur, but everything mathsy is done.
There's a lot of Array references, random numbers, sin/cos, and more, all in this little section.
Going from left to right we have..
Arrays, Basic Maths, Trigonometry and String Maths
(I'm also just noticing that the bottom row is misaligned.. bugger.. .. I'm not fixing that!)

In Spinal's picture you can see that the trigonometry is easily the biggest bump out of the whole thing. To be fair, I REALLY hammered those two lines of code in JSE. It's actually the most complex lines of code in the whole benchmark.
But it means I've got something fun to work towards. A nice little target that I can whittle away at, trying to get things nice and speedy.

Over the course of the day, I've managed to get my own MacBook's total time down from 70.61 seconds to 66.64, which is a fair amount of optimisationalisming, as-is, but I'm fairly sure I can come up with a few more tweaks beyond that.

I just need to make sure I don't end up back at 94.55 again, like I did at one point in the day!

Anyhoo, if you want to give it a go, you can run it here.
Let it run, then take a screenshot of the end screen and pop it up somewhere I can see it. An easy way might be over on the Discord?

Let's Optimise!!!


A.I. Corner


Lyrics : By me
Sound Imported : Fanatically Decided
> Reveal 🔎

: Download | Suno Link

Alternative version
: Download | Suno Link
Sung by Suno


"Knitted Cartoon Derek weaves his code like threads of wool. cinematic, colourful, saturated" by DrawThings / Flux

> Reveal 🔎
Views 39, Upvotes 1  
Daily Blog , Jse , Optimising
New games every week!
Site credits : Jayenkai, one crazy fool who has far too much time on his hands.
(c) Jayenkai 2023 and onwards, RSS feed 92

Blog - 🤡-16- Optimising! - AGameAWeek