Boost logo

Boost Users :

Subject: Re: [Boost-users] [Interprocess] [file_mapping] is there any way to avoid writing a modified file to disc?
From: Bill Buklis (boostusr_at_[hidden])
Date: 2011-12-07 13:37:37


>> I also speculate if its actually any faster, since I need to change
>> every single byte in the memory region (I'm decrypting).
>>
>> My understanding of these OS features are weak, but my mental model of
>> it is that
>> ...

I'm by no means an expert on this either, but my understanding is that
using memory mapped files is faster especially when you need random
access to the file and it allows you to have a logical view of the file
greater than what you could normally fit into memory. Even sequential
read access may be quicker as it should prevent any double buffering. In
the normal case, I would expect that memory writes would be slower since
it has to either write the data to the file or cache it for later
writes. However, I think for what you're doing you may be better off
reading the file into normal memory and manipulating it there. Even with
copy on write, you're essentially forcing the OS (through a write
protected memory exception) to copy the file into memory anyway.

-- 
Bill

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net