[fpc-devel] TMemIniFile proposed patch

Patrick Chevalley pchevalley at gmail.com
Sat Feb 4 17:35:49 CET 2006


Hi,

I notice my application take a lot of time while writing it's
configuration to a .ini file using TMemIniFile, up to 10 seconds for a
12K file. With the proposed patch it do the same instantly.

This is because TMemIniFile do not implement it's own WriteString
function but use TIniFile one.
This imply to write the full file each time a string is changed.

Delphi TMemIniFile use a buffered write as describe in this paragraph
extracted from the Delphi help:

Unlike the TIniFile object, which also encapsulates INI file data,
TMemIniFile buffers all changes to the INI file. The INI file is read
once, when the object is first created. ... After the data is read, any
changes to the data are stored in memory. To write the data from memory
back to the associated INI file, call the UpdateFile method.

There is no problem while reading the file because TIniFile.ReadString
is already buffered contrary to the Delphi implementation.

I hope this change to fcl/inc/inifiles.pp (or a variation) can be
applied to the fcl.

Patrick Chevalley

-------------- next part --------------
A non-text attachment was scrubbed...
Name: inifiles.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20060204/872b6467/attachment.bin>


More information about the fpc-devel mailing list