DEV Community

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

Collapse
 
ralphhightower profile image
Ralph Hightower

Yes.

  • Loop optimization: moving invariant code out of loops. One instance was retrieving holidays from a database table.
  • Eliminate retrieving data twice. There were internally developed base class for retrieving a row, and rows from database tables. The class that retrieved rows, first retrieved rows from the table, using the rows returned and then retrieved the the rows individually again to create the list. Why do that all over again? You've already got the data.