Is it any faster to read array slices than just elements of an array?

ZILtoid1991 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 8 10:01:43 PDT 2015


While I technically finished the 0.2 version of my graphics 
engine which has a reasonable speed at low internal resolutions 
and with only a couple of sprites, but it still gets bottlenecked 
a lot. First I'll throw out the "top-down determination 
algorhythm" as it requires constant memory paging (alrought it 
made much more sense when the engine was full OO and even slower).

Instead I'll use a overwriting ("bottom-up") method. It still 
needs constant updates and I have to remove the per sprite 
transparency key and use a per layer key, however it requires 
much less paging, and still have the ability of unbound layer 
numbers and sprite count with unbound sizes.

I also came up with the idea of reading slices out from the 
graphical elements to potentially speed up the process a bit, 
especially as the custom bitmaps it uses are 16bit for palette 
operations, so per pixel read operations would waste a portion of 
memory bus. So should I write a method for the bitmap class which 
gets a line from it? (an array slice as it contains the data in a 
single 1D array to avoid jagged arrays on a future expansion for 
a scaler) And can I write an array slice at a position of an 
array? (to reduce writeback calls)


More information about the Digitalmars-d-learn mailing list