Re: [fpc-devel] TMemIniFile proposed patch
Patrick Chevalley wrote: Applied, thx. 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. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] TMemIniFile proposed patch
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 Index: inifiles.pp === --- inifiles.pp (revision 2428) +++ inifiles.pp (working copy) @@ -133,6 +133,8 @@ FStream: TStream; private procedure FillSectionList(AStrings: TStrings); + protected +procedure WriteStringInMemory(const Section, Ident, Value: String); public constructor Create(const AFileName: string); constructor Create(AStream: TStream); @@ -154,6 +156,7 @@ procedure GetStrings(List: TStrings); procedure Rename(const AFileName: string; Reload: Boolean); procedure SetStrings(List: TStrings); +procedure WriteString(const Section, Ident, Value: String); override; end; implementation @@ -559,7 +562,7 @@ end; end; -procedure TIniFile.WriteString(const Section, Ident, Value: String); +procedure TIniFile.WriteStringInMemory(const Section, Ident, Value: String); var oSection: TIniFileSection; oKey: TIniFileKey; @@ -586,6 +589,13 @@ oSection.KeyList.Remove(oKey); end; end; + end; +end; + +procedure TIniFile.WriteString(const Section, Ident, Value: String); +begin + if (Section '') and (Ident '') then begin +WriteStringInMemory(Section, Ident, Value); UpdateFile; end; end; @@ -788,4 +798,11 @@ FillSectionList(List); end; +procedure TMemIniFile.WriteString(const Section, Ident, Value: String); +begin + if (Section '') and (Ident '') then begin +WriteStringInMemory(Section, Ident, Value); + end; +end; + end. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
On Sunday 05 February 2006 19:25, VisionForce wrote: On Unix platforms, you don't need to do anything. Just use read/write functions to communicate with the world around you. On Windows, you need to define that you are not working with a GUI program, which you do like this: {$APPTYPE console} I think that is with Delphi. Isn't freepascal the opposite, where in fact command line mode is default and you must explicitly specify app type of GUI if you want a GUI? Oh, I thought the original question was about Delphi - one of the recent questions were :) Oh it might have been - I guess it depends on his decision to use fpc or delphi? :) Which should I use when creating a server-side web language? I'd recommend FreePascal, no doubt about it. It would be perfect for the job. (Not that delphi would be bad, but I'd say it's biggest strength is GUI design) -- Regards, Christian Iversen ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
On Sunday 05 February 2006 19:25, VisionForce wrote: On Unix platforms, you don't need to do anything. Just use read/write functions to communicate with the world around you. On Windows, you need to define that you are not working with a GUI program, which you do like this: {$APPTYPE console} I think that is with Delphi. Isn't freepascal the opposite, where in fact command line mode is default and you must explicitly specify app type of GUI if you want a GUI? Oh, I thought the original question was about Delphi - one of the recent questions were :) Oh it might have been - I guess it depends on his decision to use fpc or delphi? :) Which should I use when creating a server-side web language? I'd recommend FreePascal, no doubt about it. It would be perfect for the job. (Not that delphi would be bad, but I'd say it's biggest strength is GUI design) -- Regards, Christian Iversen Do you know of a better Pascal IDE? The FreePascal IDE is a DOS window and it's really hard to work with. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
VisionForce wrote: On Sunday 05 February 2006 19:25, VisionForce wrote: On Unix platforms, you don't need to do anything. Just use read/write functions to communicate with the world around you. On Windows, you need to define that you are not working with a GUI program, which you do like this: {$APPTYPE console} I think that is with Delphi. Isn't freepascal the opposite, where in fact command line mode is default and you must explicitly specify app type of GUI if you want a GUI? Oh, I thought the original question was about Delphi - one of the recent questions were :) Oh it might have been - I guess it depends on his decision to use fpc or delphi? :) Which should I use when creating a server-side web language? I'd recommend FreePascal, no doubt about it. It would be perfect for the job. (Not that delphi would be bad, but I'd say it's biggest strength is GUI design) -- Regards, Christian Iversen Do you know of a better Pascal IDE? The FreePascal IDE is a DOS window and it's really hard to work with. Lazarus? BTW: Most fpc development is done with the text mode ide and it's very efficient to work with it especially since it works also through ssh etc. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
Which should I use when creating a server-side web language? I'd recommend FreePascal, no doubt about it. It would be perfect for the job. (Not that delphi would be bad, but I'd say it's biggest strength is GUI design) -- Regards, Christian Iversen Do you know of a better Pascal IDE? The FreePascal IDE is a DOS window and it's really hard to work with. Lazarus? BTW: Most fpc development is done with the text mode ide and it's very efficient to work with it especially since it works also through ssh etc. Hmm, okay. I didn't know I could use Lazarus for code that is only Pascal, but I guess that's just stupid to have not thought of that. About the text mode ide; I have a lot of trouble with copying/pasting and moving through the text. I don't know, I can just move faster in Visual Studio because it's a Windows IDE. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
VisionForce wrote: Which should I use when creating a server-side web language? I'd recommend FreePascal, no doubt about it. It would be perfect for the job. (Not that delphi would be bad, but I'd say it's biggest strength is GUI design) -- Regards, Christian Iversen Do you know of a better Pascal IDE? The FreePascal IDE is a DOS window and it's really hard to work with. Lazarus? BTW: Most fpc development is done with the text mode ide and it's very efficient to work with it especially since it works also through ssh etc. Hmm, okay. I didn't know I could use Lazarus for code that is only Pascal, but I guess that's just stupid to have not thought of that. About the text mode ide; I have a lot of trouble with copying/pasting and moving through the text. I don't know, I can just move faster in Visual Studio because it's a Windows IDE. Well, I use VS at work, but I know which IDE is more efficient, e.g. instant start of compiler etc. :) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Web language
On Sunday 05 February 2006 21.45, VisionForce wrote: Do you know of a better Pascal IDE? The FreePascal IDE is a DOS window and it's really hard to work with. MSEide: http://mypage.bluewin.ch/msegui/ Screenshots: http://freepascal.ru/article//mse/20060109011638/ Note the double slash between article and mse. Martin ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel