New games every week!
JSE - Optimising Blog
13th July 2021
I posted the first version of JSE : Futrino Emissions over on SoCoder, yesterday.
The most obvious thing to note..
.. I definitely need to optimise things!

-=-=-

One thing I've been tempted to do is move the drawing to a "Backbuffer" and then have everything be double-buffered and running a little nicer whenever the frame-timeout kicks in.
That would get rid of any of the flickering, but unfortunately would force the user to use either the Flip/Frame/WaitVBL command, or else .. NOTHING will happen, onscreen.

A simple 10 Print "Hello"/20 Goto 10 would no longer function because there's no Flip in there.

The other option is to do what Blitz2D/3D did, and have the coder switch on the Backbuffer mode themselves. .. This actually feels like the better choice, right now, since it also reduces the possibility of me breaking older projects.

Meanwhile...


Back to the subject of Optimisation, and I whittled another 10% or so out of the engine late last night.
Removing the need to LowerCase everything, I've rewritten a chunk of the pre-parser to LowerCase .. Everything!!!
I was quite surprised to find the toLowerCase command was actually staggeringly slow, when in use.
Who knew.

I also played around with a couple of test scripts to stress test different "jumping" methods.
The command list is currently a huge Switch function, letting the Javascript hop around wherever it needs to.
But I wondered if, perhaps, splitting the giant command list into sections, and having the parser jump between those sections, then find the right command in a smaller Switch, might be quicker than doing one great big Switch.

The results were quite illuminating.
Though the difference between Numbers and Strings in the switch is negligible, jumping in and out of a function is a fairly significant increase in the time taken.
On top of that, if I did indeed nest the Switch checks, it makes a significant difference in the time the script takes to run.. On my system it's tripling the time it takes, which is .. alarming.
Certainly glad I checked that first!

You can see the results of the test for yourself, here. It's a tiny tiny script, so loads in next to no time, but takes AGES to run, so .. Give it time.. it'll show up eventually!

Futrino, then..


Yeah, the game runs, as long as you have the power!!
If you'd like to play the game in it's current form, it can be found on the black Play disk.
Just, be sure you have a fast system


View on YouTube
Views 69, Upvotes 4  
Daily Blog , Jse , Futrino
New games every week!
Site credits : If you can see it, Jayenkai did it.
(c) Jayenkai 2023 and onwards, RSS feed

Blog - JSE - Optimising - AGameAWeek