Hi, Interesting, yes AnsiString routines are known to be pretty slow especially on large strings.
Not sure if this works in FreePascal but for really fast string routines including StringReplace consider Faststrings from Peter Morris. It is free and very fast and much more very friendly on cpu usage. http://www.droopyeyes.com/default.asp?mode=ShowProduct&ID=4 regards Gerard Jim Shew wrote: > I replaced an AnsiReplaceStr with a simple loop. > Results are dramatic. > I know this is off topic for synapse, but this is > such a major performance issue that I thought it > was worth mentioning. > > This sample program illustrates the change. > > {$MODE DELPHI} > Program test09; > uses > sysutils, strutils; > var > s:AnsiString; > i:LongInt; > begin > s:=DupeString(#09,128000); > Writeln ('Begin test09 ',FormatDateTime('YYYY/MM/DD HH:NN:SS',Now)); > If (Paramstr(1)='a') Then > s:=AnsiReplaceStr(s,#09,' ') // replace tabs with spaces > Else Begin > i:=1; > While (i<Length(s)) Do Begin > If (s[i]=#09) Then > s[i]:=' '; > i:=i+1; > End; > End; > Writeln ('End test09 ',FormatDateTime('YYYY/MM/DD HH:NN:SS',Now)); > end. > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ synalist-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/synalist-public
