<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 11, 2012, at 4:25 PM, Jonas Maebe wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 11 Oct 2012, at 16:11, <a href="mailto:dhkblaszyk@zeelandnet.nl">dhkblaszyk@zeelandnet.nl</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 11 okt '12, Jonas Maebe wrote: <br><br><blockquote type="cite">No. You really should write the fields one by one. Yes,</blockquote><blockquote type="cite">it's slower. That's the cost of portability. You can always optimize by<br>first writing them to a buffer and then writing the buffer in one go. <br></blockquote><font class="Apple-style-span" color="#006312"><br></font>Sorry I keep asking questions, but why write them one by one? If<br>I would store the offset each variable has at the time of writing (only<br>need to do one time per record type), I could easily make the loading<br>work (even if the ABI changes when the file is read back). What makes<br>you prefer writing the variables one by one over once at a time?<br></div></blockquote></div><br><div>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.</div></div></blockquote><br></div><div>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.</div><div><br></div><div>Regards, Darius</div><br></body></html>