StringReplace alternatives to improve performance

前端 未结 8 754
温柔的废话
温柔的废话 2021-02-04 12:46

I am using StringReplace to replace > and < by the char itself in a generated XML like this:

StringReplace(xml.Text,\'>\',\'>\',[rfReplaceA         


        
8条回答
  •  逝去的感伤
    2021-02-04 13:30

    You should definitely look at the Fastcode project pages: http://fastcode.sourceforge.net/

    They ran a challenge for a faster StringReplace (Ansi StringReplace challenge), and the 'winner' was 14 times faster than the Delphi RTL.

    Several of the fastcode functions have been included within Delphi itself in recent versions (D2007 on, I think), so the performance improvement may vary dramatically depending on which Delphi version you are using.

    As mentioned before, you should really be looking at a Unicode-based solution if you're serious about processing XML.

提交回复
热议问题