Jump to content
Sign in to follow this  
Mike Torrettinni

Micro optimization: use Pos before StringReplace

Recommended Posts

2 hours ago, PhilPlus said:

I really don't understant the interest of putting StringReplace out of the current method.

To avoid Delphi's string protection that can be slow when performance is needed, but string change is rarely actually changed. See more here: https://www.delphitools.info/2009/05/06/code-optimization-go-for-the-jugular/

 

2 hours ago, PhilPlus said:

Just note that there are a lot of StringReplace more efficient than the RTL one, and I think usi,g it  is the best way for better performances. 

What Delphi version are you talking about, what faster function?

Share this post


Link to post
14 hours ago, PhilPlus said:

Just note that there are a lot of StringReplace more efficient than the RTL one, and I think usi,g it  is the best way for better performances.

Currently it's much better than it was

Share this post


Link to post
On 3/10/2021 at 8:58 AM, Fr0sT.Brutal said:

Currently it's much better than it was

You are right (it was true with XE7) tested with 10.3.1 more or less the same perfs.

Share this post


Link to post
On 3/9/2021 at 9:20 PM, Mike Torrettinni said:

To avoid Delphi's string protection that can be slow when performance is needed, but string change is rarely actually changed. See more here: https://www.delphitools.info/2009/05/06/code-optimization-go-for-the-jugular/

 

What Delphi version are you talking about, what faster function?

As said to Fr0sT.Brutal it is not true with latest versions, I tried with 10.3.1 and the time is more or less the same ! 

Share this post


Link to post

 

31 minutes ago, PhilPlus said:

As said to Fr0sT.Brutal it is not true with latest versions, I tried with 10.3.1 and the time is more or less the same ! 

That's why is good to benchmark a version you are migrating to, in case the important project performance gets better or worse. Will do the same when moving from 10.2.3 to 10.5.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×