Gah, just when you thought the JSE Optimisations were working in your favour.
-=-=-
// Optimise For Loop
// by Jayenkai
// Created 2024/2/10
// GotoJSE.com/KjXtDqv9.BAS
Graphics 512,512,1
Dim k(10,10)
k(1,3)=123
s=Mills()
mcSquared=1
q=1
for x=0 to 100
for y=0 to 100
for z=0 to 100
//e=mcSquared // Just plain variable setting
//e=mcSquared+1+(1,2) // variable with numbers
//e=mcSquared+q+(q,q) // variable with additional variables
//e=mcSquared+Sin(1)+Sin(1,2) // variable with Trig
//e=mcSquared+Rnd(1)+Rnd(1,2) // variable with Random
//e=mcSquared+k(1)+k(1,2) // variable with Arrays
next
next
CLS;LoadingBar x,"Trying","Twirl";Flip
next
ResetDraw;CLS;Print Mills()-s;Print k(1,3);Flip
We're back to testing with this bit of code again.
You can play along by uncommenting the various test lines.
If you test this on the current version of JSE (v.3gin) you should find that the "Just plain variable setting" test is more or less the same sort of speed as the "variable with additional variables" test.
But trying the "variable with Arrays" test will drop the speed fairly dramatically.
This is because arrays are slow!! (Let's call it about a 30% slower difference)
My version running locally is currently v.3gio, and I've actually done a TON of array speedups to the point where the "variable with Arrays" is now more like a 10% difference, which is a HUGE increase as far as how things run goes.
.. Unfortunately, for reasons I cannot quite fathom, whatever it is that I've done has made the unused comma in the "variable with additional variables" stick out like a sore thumb, and now THAT test is running about 40% slower than the "Just plain variable setting" test.
Now, it should be noted that the comma in that line is technically wrong, and that the line is actually an error.
But changing it from a comma to a plus makes everything fast again, so ..
Something, somewhere, is not running as smoothly in v.3gio as it did in v.3gin, and I don't know what it is that I've changed!!!
And it's likely best to figure out what that error is, now, rather than have it crop up as a bonus-bug later!
I've been wrecking my brain trying to find that, since yesterday, and I've still not discovered the error.
[Dave and Green are arranging items on the counter near the till. A menacing device labeled "ScrunchCake Sentinel Mk II" hangs from the ceiling.]
Green: I thought we were making a podium for that? How are we supposed to refuel it?
Dave: It'll be fine. Anyway, like you said, it's not exactly going to be shooting everyone all the time, is it?
Green: True. Only when there's evil thieves and burglars and suck.
Dave: Right, keyrings go at the front. Everyone loves keyrings.
Green: Do they? I've never once thought "Oh goodie, keyrings!"
Dave: Look, they've got little pictures of games on them.
Green: (picking one up) Is this... Count Duckula 2?
Dave: Super popular.
[A ScrunchCake suddenly flies across the room. Green ducks just in time.]
Dave: Dang. Maybe they're not fast enough.
Green: Why is it even active? We're not open yet!
Dave: It's learning, Greenie. Like AI, but with sausage and cake.
[Dave starts arranging small figurines]
Dave: Look, I've found these little gaming mascots on eBay too.
Green: Is that Count Duckula, too?
Dave: Sure is!
Green: Are you essentially covering the shop in Count Duckula merchandise?
Dave: Don't be silly. This one's a gorilla.
[Another ScrunchCake whizzes past Green's head]
Green: (reappears from under the counter) Dave, this thing is going to kill someone!
Dave: Nonsense. It's perfectly safe. The sponge ScrunchCakes will bounce gently off people's heads.
Green: Not at this speed they wont!
Dave: And the Trading Cards can go over there.
Green: Do people even buy Trading Cards any more?
Dave: Sure they do. Pokemon cards are still a massive impulse buy.
Green: ... But Count Duckula cards..?
[A third ScrunchCake flies through the air. Green rolls to avoid it.]
Green: Right, that's it. I'm turning it off.
Dave: No! But how else will we protect the "I survived a ScrunchCake" stickers!
Green: We're going to get sued.
Dave: It's part of the experience!
[End credits roll as another ScrunchCake flies across the screen]
Views 122, Upvotes 2
Daily Blog
,
Jse
,
Optimising
New games every week!
Places
Archives
Site credits : If you can see it, Jayenkai did it.
(c) Jayenkai 2023 and onwards, RSS feed
90