[fpc-pascal] Get empty memory quickly or... an empty file

Reinier Olislagers reinierolislagers at gmail.com
Fri Sep 13 15:42:40 CEST 2013


On 13/09/2013 15:19, Bart wrote:
> On 9/13/13, Reinier Olislagers <reinierolislagers at gmail.com> wrote:
>>   ContentStream.SetSize(1+$FFFFFFFF); //4 bytes+1
> 
> Actually 4 GB : 4294967295 + 1 = 4294967296 = 4 * 1024 * 1024 * 1024

Yes... but I had trouble counting Fs, so that reminder makes more sense
to me ;)

> Now you have 4G write calls, resulting in 4G System.Move calls.
> Maybe it is faster to create a 1GB datastructure (StringOfChar('A',
> 1024*1024*1024) and do 4 Write's?

Thanks, I'll look into it.

Meanwhile, it turns out (surprisingly ;) ) that the creation time of the
4GB memorystream pales in comparison the compression code takes...
Ah well.



More information about the fpc-pascal mailing list