Hi,
I am using D6 Professional and need to create a text file in a specific format from lots of small strings already in memory. For performance reasons, I am considering using a TMemoryStream to collate the file data, and then write it out to disk in one go via a TFileStream.
But I have a half forgotten memory (probably from pre-D6 days) of reading somewhere that TMemoryStream is inefficient, especially after it hits its Capacity size. My Delphi (and Windows API) skill is not good enough to check the Classes.pas code for myself.
(OFFTOPIC) especially code like this: (line 5152 of Classes.pas):
NewCapacity := (NewCapacity + (MemoryDelta - 1)) and not (MemoryDelta - 1);
(/OFFTOPIC)
Adding to my worry is that the conclusion of a related question
http://stackoverflow.com/questions/486843/using-memorystream-to-write-out-to-xml
was not to use TMemoryStream, but didn't say why - whether due to TMemoryStream itself, or because there is sufficient buffering in the TFileStream or the I/O device driver, or just the specifics of the code in question.
Thanks for any advice
Regards,
PhilW.