[fpc-devel] Aligned dynamic arrays

Marco van de Voort fpc at pascalprogramming.org
Fri Mar 29 23:02:19 CET 2019



Op 3/28/2019 om 11:40 PM schreef Anthony Walter:
> Here is a brief follow up. I am working on other projects at the 
> moment, but I am confident this a simple solution. Please tell me if 
> this somehow will not fit you needs.
My needs are simple:

- auto clean like dynamic arrays.
- preferably transparent with all existing mechanisms.
- performance is important so no getters and setters (the units are 
pixels, and getters and setters in such cases slow down too much).
- I mostly align for SSE/AVX not DMA, so my alignment is typically 
64byte, I'd rather not use special functions that don't allocate via the 
pascal suballocator, that would only
increase fragmentation

However currently I have stowed the alignment requirement away in a few 
classes which are manually specialized versions of a generic one for 
different pixel size derive/specialize (*), so while I'm an alignment user,
I'm not the best motivation to pull it in language.


(*) 8-bit grayscale and  24-bit RGB have manually specialized classes, 
the rest uses an generic, which optimizes not as well in Delphi, but 
good enough for all but the most extreme speed.  The 24-bit RGB case is 
also due to bugs in older (<=XE6) Delphis that
don't deal well with pointer math of 3-byte types.



More information about the fpc-devel mailing list