2 ms·
Date.parse is really incredibly slow, because it tries all the format parsers until it get one that works. If the format you're trying to parse is low in that l
by psadauskas 16y ago
Date.parse is really incredibly slow, because it tries all the format parsers until it get one that works. If the format you're trying to parse is low in that list, its going to be very slow.
If you know your format (iso8601, etc), you're better off just using the right parser instead of Date.parse.
Also the internal representation uses Rational, which can be pretty slow itself.
Date.parse: http://github.com/ruby/ruby/blob/trunk/lib/date/format.rb#L1028 http://github.com/ruby/ruby/blob/trunk/lib/date/format.rb#L1...
edit: correction to how parse works.