Programming performance issues can be a frustrating and time-consuming problem for developers. However, tracking down these issues is a crucial step in creating software. Here are some steps that developers can take to track down programming performance issues:
The first thing to do is ALWAYS hook up a profiler to your code, reproducing your issue, and measuring what is causing it. Performance issues are often not obvious and if you don’t profile you’ll waste a bunch of time speeding up things that don’t matter(or just hide the base issue).
In my experience, here are the main areas you get performance issues:
- DB
- DB
- DB
- DB
- API Calls
- External Access
A little hint: most of the time you are optimizing your code and not these other areas, you are reducing readability and not significantly impacting your load times for users.
Outside of these issues, it is often something silly a developer is doing. Some of the things I’ve seen:
- Pulling the whole table down(all 1 million records) then filtering on the application server
- Creating new instances of classes that do a lot of work on creation instead of reusing them
- Really bad exception throwing that is used as control flow
- Sending down 8 megabytes of HTML for a page, of which 6 megabytes is double escaping special characters (sending ////” instead of “)
Once you figure out where the main areas of slowness, it’s time to refactor!