[your code here]

Vladimir Panteleev vladimir at thecybershadow.net
Thu Jan 31 05:21:13 PST 2013


On Thursday, 31 January 2013 at 12:28:43 UTC, FG wrote:
> On 2013-01-31 12:38, Namespace wrote:
>> If you want to do something, then take destroy.
>> AFAIK delete destroy _and_ release the memory immediately. 
>> 'destroy' doesn't.
>
> And that's why delete is valuable (at least on 32-bit windows).
> Especially when you are comparing 500 MB files in a loop. :)

If we are talking about memory mapped files, then destroying the 
MmFile classes will close the mappings, thus freeing the virtual 
memory.

Anyway, I'm really impressed by this example, as the kernel may 
be inclined to leave the pages we've already compared in RAM 
(might be fixed with madvise(MADV_SEQUENTIAL)), and it doesn't 
demonstrate many D strengths (memory-mapped files are an OS 
feature, for which D just provides a wrapper class). Maybe it 
would be more interesting if we use std.algorithm.zip or 
.lockstep or .equal with File.byChunk?


More information about the Digitalmars-d mailing list