• 0 Posts
  • 2 Comments
Joined 2 years ago
cake
Cake day: June 13th, 2023

help-circle
  • I found code that calculated a single column in an HTML table. It was “last record created on”.

    The algorithm was basically:

    foreach account group
      foreach account in each account group
        foreach record in account.records
          if record.date > maxdate
            max = maxdate
    

    It basically loaded every database record (the basic unit of record in this DATA COLLECTION SYSTEM) to find the newest one.

    Customers couldn’t understand why the page took a minute to load.

    It was easily replaced with a SQL query to get the max and it dropped down to a few ms.

    The code was so hilariously stupid I left it commented out in the code so future developers could understand who built what they are maintaining.