You are not logged in.
Pages: 1
Hi AB,
i found this on the Net
FastStringReplace function from Alexandre Caldas Machado :
http://alexandrecmachado.blogspot.com/2 … elphi.html
http://alexandrecmachado.blogspot.com.a … e-fix.html
It more than 100% (double) faster than Mormot StringReplaceAll although using 2Byte Char. (I made a test with the StringReplace included StringReplace Test Pgm)
May be you like it...
Rad Studio 12.1 Santorini
Offline
@itSDS, Very nice finding and thanks for sharing!
I added to items to the benchmark list, it's ReplaceStr and ReplaceText.
Test results on my computer:
Standard StringReplace(): 0.2180 secs
StringReplace1: 0.1250 secs
StringReplace2: 0.1090 secs
StringReplace3: 1.7630 secs
StringReplace4: 0.0780 secs
FastStringReplace: 0.0310 secs
ReplaceStr: 0.2340 secs
ReplaceText: 0.3430 secs
The winner is: FastStringReplace
------------------------------------------------------------
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
StringReplaceAll() is used in no performance-critical place of mORMot.
So it was not specifically optimized for speed.
But I've made simple speed enhancements.
See http://synopse.info/fossil/info/73f6168422
You may be able to benchmark the new version...
Feedback is welcome!
Offline
@ab, Updated the mORMot framework and added StringReplaceAll to the benchmark test, here is the result:
Standard StringReplace(): 0.2340 secs
StringReplace1: 0.1250 secs
StringReplace2: 0.1090 secs
StringReplace3: 1.7160 secs
StringReplace4: 0.0780 secs
FastStringReplace: 0.0470 secs
ReplaceStr: 0.2500 secs
ReplaceText: 0.3430 secs
StringReplaceAll - Implict to UTF8: 0.1250 secs
StringReplaceAll - EXplict to UTF8: 0.0620 secs
The winner is: FastStringReplace
------------------------------------------------------------
New finding: Use of StringToUTF8 can really improve the performance
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Yes, our optimized version of StringToUTF8/UTF8ToString is faster than the default Delphi RTL conversion, which uses the Windows API...
It is always a good idea to follow the compilation hints to ensure that an explicit conversion is done, using SynCommons.
Offline
Pages: 1