Banks vs Arrays

Blitz3D Forums/Blitz3D Programming/Banks vs Arrays

Ezbe(Posted 2004) [#1]
Are arrays faster than banks? I've always thought otherwise, but while making my own bank library, I decided to test it.



I get around 6500ms for bank and around 5000-5300ms for array. Have I made some mistake in the test-code?

The commented out ways of calculating the position within the bank don't affect the results much. Array is faster even if it is re-dimmed every 'x'-loop


N(Posted 2004) [#2]
Arrays are going to be faster because you don't have to use a go-between function to get at the data (in a sense).

I myself don't use arrays or banks when I can avoid them, I prefer to use stacks. (My stack code)


danjo(Posted 2004) [#3]
i like arrays - they keep things simple for me. then comes along noel with his stack code to slap my brains around a bit :P


morduun(Posted 2004) [#4]
I quite like banks actually; they may be slightly slower than arrays depending on your usage, but the fact that you can slam a bank handle into a type instance field means you can store a shedload of local variables in a 100% flexible format per instance without having to predefine anything other than the header format at design time.

Pretty much the only thing I still use arrays for are tiled maps, and even then I've started to use banks for those instead (especially on certain i/o routines, like grabbing from dlls or reading from the filesystem).


Fry Crayola(Posted 2004) [#5]
I like banks when it comes to compressing data during run-time. For example, my game has a heck of a lot of data which would hog the memory like crazy if left in array form. By reducing it to mere bit patterns and only using the bare minimum amount of bits, I can cram a lot more in.