All posts filed under: ruby

Stupid coding mistakes

programming / ruby

Made this mistake today while writing some code to delete data out of Redis. [crayon-5f937a582f3a7976868683/] The mistake was in the final method keep_keys. Every check to see if a key should be rejected I was adding an element to the flattened_keys array over and over again, causing my deletion to slow down over time. A simple change to memoize the keep keys made the process go from never finishing to, completing in a few seconds. […]