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.  

-- 
Want an e-mail address like mine?
Get a free e-mail account today at www.mail.com!


-------------------------------------------------------------------------
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

Reply via email to