Interesting video about optimizations in BlitzMax by Jake Birkett

Started by ricardo_sdl, March 19, 2025, 17:02:25

Previous topic - Next topic

Baggey

Awesome cant wait to see more of your stuff!

Ive tried a lot of languages This is Basic as fast as 'C' in a nutshell! :D

Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!


GreyAlien

I noticed someone on the purebasic forum said: "As interesting as this video is, I was amazed at how he optimised by reshuffling existing code and did not first perform any analysis of whether the algorithms used could be improved upon.
 Basically, he did what a good compiler would be able to do, but nothing more."

I did have quick a look at the main algorithm and it seemed OK, but I didn't do a deep dive into it because I am working on a commercial game and needed to speed this code up and move on. Also the main algorithm is well-established and documented and I *hoped* that the original BlitzMax programmer did a good job of it (this could be a false assumption). A second programmer had written the wrapper for it. I'm not sure who wrote what.

Outside of the main core algorithm I spotted that I could: a) replace the file-based stream function calls with a RAMStream, and in fact I could also just use my own array of memory with pointer in some places, b) inline and optimise a bunch of the very frequently called supporting functions e.g. the stack function.

By the time I got to 3x faster, it was good enough for my purposes! So I moved on.

col

This is a good mindset. Knowing when enough is enough, keeping your eye on the end goal instead of getting easily distracted by a potential small side project of optimising the code to the maximum.

If you experience issues down the line during development then you can optimise more. Premature optimisation is a painful waste of time.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."