[Lazarus] Reading a spreadsheet with fpspreadsheet

Koenraad Lelong lazarus1 at de-brouwerij.be
Mon Aug 2 08:11:40 CEST 2010

On Sun, 01 Aug 2010 13:46:00 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> Mattias Gaertner schrieb:
> > Correct me if I'm wrong: memory mapped files is a more direct access to
> > the OS file cache. You can omit the copy on loading and the copy-back
> > on writing.
> Yes.
> > The IDE loads/saves files as whole with one TFileStream.Read/Write
> > call.
> The related file buffers are subject to swapping, i.e. they may have to 
> be written to the swap file. MMFs deserve no such writes, except for 
> changed parts, since they can be reloaded from the original disk file or 
> cache.

For the IDE this will at most save 20% of the needed memory. For normal
projects it will be probably less than 10%. I didn't heard complains
that lazarus needs too much memory in the last years, especially not
on 64bit systems.

> > I tried to measure the time of the copy: 
> > The code browser loads under Linux fpc 2.5.1 about 87 MB of sources
> > and takes on this machine about 4.5 seconds.
> > I doubled the copy on load and it is still about 4.5 seconds.
> > I put the copy on load in a loop for 10 times and it is still about 4.5
> > seconds.
> > That's why I doubt that memory mapped files will give a noticeable speed
> > increase.
> I have no practical experience with MMFs myself, but users reported 
> factors of 3 in reading files (Delphi/Win32). At least it would be worth 
> a try.

It heavily depends on file access pattern. Make your own tests.


More information about the Lazarus mailing list