read() performance - Linux.too?

Unknown W. Brackets unknown at simplemachines.org
Mon Jul 24 23:04:09 PDT 2006


Yet, someone could also do this:

ubyte[] buffer = std.file.read(filename);
*(buffer.ptr + 9000) = 0;

That would probably be a Bad Thing as well, doesn't mean Phobos should 
worry about it...

I completely agree that Phobos' read() should have a removeRange() call 
there, unless it is decided to add such a thing to the standard library.

-[Unknown]


> Derek Parnell wrote:
>> On Mon, 24 Jul 2006 04:55:17 +0200, Bob W wrote:
>>
>>> /*
>>> The std.file.read() function in dmd causes a performance
>>> issue after reading large files from 100MB upwards.
>>> Reading the file seems to be no problem, but cleanup
>>> afterwards takes forever.
>>
>> Its a GC effect. The GC is scanning through the buffer looking for
>> addresses to clean up.
> 
> I just read the response to my post and it seems the read() function 
> should do the std.gc.removeRange on the memory containing the read file, 
> no? There's no way that memory could contain pointers.
> 
> Of course, somebody could change the memory afterwards, replacing 
> internal file references with memory pointers and it'll get f**** up.
> 
> L.



More information about the Digitalmars-d mailing list