URI.decode_www_form_component very slow with certain inputs
When calling the following I get what I'd expect. An error.
Here's the IRB output:
ruby-1.9.2-p290 :003 > URI.decode_www_form_component("aaaaaaaaaaaaaaaaaaaa%")
ArgumentError: invalid %-encoding (aaaaaaaaaaaaaaaaaaaa%)
But as I add more characters to the string, the execution becomes much much slower. I would expect it to be a lot faster than it is.
Add more characters and the call would take hours, if not days.
Related blog post: http://rrn.dk/running-ruby-process-callstack
I've reproduced this bug on these rubies:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.1]
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]