I wrote some code in C and I was surprised to see it take a longer time to execute than I expected. I want to know which operations are costly and how to get rid of them.
I use assignment statements, conditional(nested), loops, function calls and call backs.
What are some good references to common C performance pitfalls?
Is there a good profiler I can use?
Thank you all
Thanks for all your inputs. You are absolutely right: It's algorithms that can slow things (drastically). Though a little performance gain can be achieved by coding practices - I am 100% convinced that only faulty algorithm can drastically slow down things.
As a matter of fact: I was working on RB trees and inserting nodes in ascending order. It took enormous time (as bad as Binary Search Tree (Skewed) ). After seeking your advice I checked the algorithm where I made a mistake in balancing which made the tree leaning (skewed). I corrected it.
Thanks once again for the suggestions.