DEV Community

Discussion on: How Have You Refractored or Optimized Code for Improved Performance?

Collapse
 
ralphhightower profile image
Ralph Hightower

I was part of a development team that were developing Microsoft ISAPI extensions in C++
for a web application.

  • Move invariant code out of loops. There was a utility function that returned the holidays for a year from a database. It was being called repeatedly while processing rows from a different database query.
  • Minimize database repetitions. There was an internally developed base class that retrieved rows from SELECTs on tables. The base class first performed the query and then processed the rows, and performing another SELECT for the row that was returned. The base class to retrieve rows already has the data. Why SELECT the row again? I rewrote the base SELECT rows class and modified the classes that used the base class.