Hi,
See: https://community.appeon.com/index.php/qna/q-a/use-c-for-replace-function
As suggested by Mark Goldsmith, I've compared my timings of PB2021 with PB2022. Quite interesting!
Pb2021:
f_str_replace: 352.703 seconds. (point as decimal separator)
PFC- Mid() (of_globalReplace): 203.922 seconds
Roland's BlobMid() solution: 134.453 seconds.
Dotnet_replace C# DLL: 0.015 seconds.
pb2022:
f_str_replace: 117.9 seconds. (point as decimal separator)
PFC- Mid() (of_globalReplace): 172.6 seconds
Roland's BlobMid() solution: 26.5 seconds.
Dotnet_replace C# DLL: 0.031 seconds.
Conclusion:
In pb2022, f_str_replace is now more than twice as fast and even outruns the PFC Mid() based of_globalReplace function !!! Maybe something we could consider when doing any PFC improvements! The PFC replace has also improved, but not as much and no longer remains a better solution than a normal Replace().
Roland's stringclass BlobMid() based solution has improved enormeously too! Very impressive.
Interesting enough, though still the fastest, the DotNet replace has doubled time execution: from 0.015 to 0.031 seconds.
With PB2021, I would only get 0.031 seconds when using a DLL that was compiled for "any cpu". Now the x86 compilation is just as slow in pb2022.
regards,
MiguelL
Don't forget. It's only faster when doing a lot of search and replace within a string, which as for now requires us to do looping. For a single Replacement in a 'normal' length string, PB's current replace is perfect! I've requested a ReplaceAll() function to Appeon though, where something like that would definitely give us a lot of gain, be it in C, C++, ASM or C#.
Regards.