First page Back Continue Last page Overview Graphics


The Date strftime instance method is known to be quite slow.

It uses the block form of the String gsub instance method, and breaks each match into three parts. It builds a hash of options for every match, and for each recognized format, calls another method to create the replacement string, and those methods aren't fast either.

If that wasn't bad enough, the strftime method actually calls itself recursively in many cases, including the case where the default argument is used.