[fpc-pascal] AnsiStrings and Memory Management

Florian Klaempfl florian at freepascal.org
Wed Dec 14 22:23:40 CET 2005


Adrian Veith wrote:

> Hi,
> 
> two days ago i posted a comment about my experiences porting our
> database server to fpc. yesterday i tried to figure out where the speed
> differences between delphi and fpc come from. At the moment i stuck a
> little bit, because the results i get don't make any sense at the moment
> to me.
> Anyway i dropped over another problem, which might be part of the cause
> of my problems. I tried to create a test base for my investigations and
> created a function NumberToText which converts an integer to written
> text  (like NumberToText(1234) -> "one thousand two hundred thirty
> four"). When I filled my database with these generated strings I found
> some significant speed differences between delphi and fpc (over factor
> 10), which made me curious. According to your comments about my first
> posting, i suspected the Memory Manager and created three different
> versions of this NumberToText function and three test loops which each
> calls the according NumberToText function for 0..999999. Here are the
> results for fpc and delphi (w and w/o FastMM4)
> 
> Test1 uses "optimized" string concatention which avoids heap fragmentation

Did you try/have an unoptimized version? FPC doesn't need these
optimizations, I fear they hurt only.



More information about the fpc-pascal mailing list