9

debugging a performance issue. basically the original dev had no idea what a database was for. system was generating millions of buffered reads, and paging horribly.

to see if an id existed they had done the following:
fetch all 1 million rows into an array.
iterate the array looking for a match.
if found, set found=true
continue to iterate the rest of the array.
return found.
repeat at every login.

replaced with
return person.get(id)

set world record for most i/o avoided with one liner.

Comments
Add Comment