[fpc-pascal] Memory alignment with FPC
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Oct 11 16:25:44 CEST 2012
On 11 Oct 2012, at 16:11, dhkblaszyk at zeelandnet.nl wrote:
> On 11 okt '12, Jonas Maebe wrote:
>
>> No. You really should write the fields one by one. Yes,
>> it's slower. That's the cost of portability. You can always
>> optimize by
>> first writing them to a buffer and then writing the buffer in one go.
>
> Sorry I keep asking questions, but why write them one by one? If
> I would store the offset each variable has at the time of writing
> (only
> need to do one time per record type), I could easily make the loading
> work (even if the ABI changes when the file is read back). What makes
> you prefer writing the variables one by one over once at a time?
I always prefer simple techniques over elaborate strategies aimed at
optimizing things, especially if it's not clear that they will ever be
the performance bottleneck in the first place. You're moreover trading
space (storing all the offsets) for cpu operations here, and I/O is
generally two or more orders of a magnitude slower than moving data in
memory.
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20121011/a388b57c/attachment.html>
More information about the fpc-pascal
mailing list