On Oct 11, 2012, at 4:25 PM, Jonas Maebe wrote: > > On 11 Oct 2012, at 16:11, dhkblas...@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.
Thanks for the tip, I'm doing more tests using buffered reading and writing. I can write 1GB in about 25sec now, which seems to be acceptable. Reading data is still on my todo. However I have some profiling problems, see other thread. Regards, Darius
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal