[fpc-pascal] Effective memory allocation
xrfang at gmail.com
Mon Nov 3 02:59:34 CET 2014
2014-11-03 2:50 GMT+08:00 Sven Barth <pascaldragon at googlemail.com>:
> If you use SetLength the dynamic array consists not only of the array
> data, but also of an information record in front of it. This will likely
> lead to the data not being aligned correctly (FillQWord works best with
> 8-Byte alignment). So what about testing FillDWord or FillChar? Just to see
> whether they would be faster.
> It is quite strange that if I use SetLength+FillByte, it is really faster
(for the FillByte), but if I use GetMemory+FillByte, it is not faster than
using FillDWord or FillQWord.
I found this in FPC doc (for $ALIGN switch):
This switch is recognized for Turbo Pascal Compatibility, but is not yet
implemented. The alignment of data will be different in any case, since
Free Pascalis a 32-bit compiler.
It is a pity that this switch is not recognized yet. But I need to
understand the last statement, will alignment be different or not?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal