Jump to content
Mike Torrettinni

How do you identify bottleneck in Delphi code?

Recommended Posts

I use a profiler and I try to avoid wasting memory allocation.

 

I've seen code searching for POST,PUT,GET,DELETE in a string spread all over the place. Why does one need to search so much? Parse and search once. Use enumerated types. There's a plethora of ready to use structures.
Sometimes too KISSy is not KISS but simply S.

 

 

 

 

 

  • Thanks 1

Share this post


Link to post
23 hours ago, Bill Meyer said:

Performance optimization should be done because of performance issues, not simply to see whether you can buy another 10% improvement in a routine which doesn't affect user perception at all.

 

You forgot one important reason to optimize: The pure fun of it. 😉

  • Like 4

Share this post


Link to post
1 minute ago, dummzeuch said:

You forgot one important reason to optimize: The pure fun of it. 😉

You're right. But I find the fun proportional to the improvement.

Share this post


Link to post
1 hour ago, Bill Meyer said:

You're right. But I find the fun proportional to the improvement.

Hey, I am the German here (*1). But now you sound like one. 😉 Spoilsport!

 

(*1: Of course I am not the only German here.)

  • Haha 1

Share this post


Link to post
Just now, dummzeuch said:

Hey, I am the German here (*1). But now you sound like one. 😉 Spoilsport!

 

(*1: Of course I am not the only German here.)

I'm three generations removed from my German ancestry.

Share this post


Link to post

I just realized I can do a better comparison of new vs old methods, when optimizing code: in the past I would profile old version, and save profiling results, then run new and compare screenshots of timings.

But is much better if you run both methods at the same time and compare results:

 

image.png.0d470dacacd5af79900487df5158cb3f.png

 

This way I can keep both methods in the same code, compare small improvements and I can switch on/off old vs new when profiling and see the progress of eliminating or reducing bottlenecks.

 

 

Edited by Mike Torrettinni

Share this post


Link to post
On 2/18/2021 at 7:42 AM, Clément said:

I've seen code searching for POST,PUT,GET,DELETE in a string spread all over the place. Why does one need to search so much? Parse and search once. Use enumerated types. There's a plethora of ready to use structures.

I had similar situation with using Copy, Left, MidStr... It started years ago with one search, then same or similar search in another feature and so on... and each time I was asking myself do I really need more robust solution, if I just need it 'this time' (forgetting about the other 'this times'), and so it went unchecked for years until it was time to refactor and finding fast and robust solution.

 

I have same thing now with refactoring all different look-up tables (arrays). Many many different implementations and now going to refactor into fast and robust solution(s).

And just refactoring and improving memory consumption and using faster algorithms instead of many slow different implementation, I'm improving performance of the whole project, even though there was no single bottle-neck related to this.

 

So, I guess I could say the bottle-neck were all these inefficient implementations all over the project, so everything 😉

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

×