brianmario / escape_utils

Faster string escaping routines for your ruby apps
MIT License
513 stars 52 forks source link

Should we deprecate `escape_url` and `unescape_url` ? #79

Closed casperisfine closed 2 years ago

casperisfine commented 2 years ago

Similar to https://github.com/brianmario/escape_utils/pull/78

If the README is to be believed, historically EscapeUtils.escape_url was about 40 times faster than GCI.escape:

CGI.escape
 0.440000   0.000000   0.440000 (  0.443017)
EscapeUtils.escape_url
 0.010000   0.000000   0.010000 (  0.010843)

But running the benchmark on a modern Ruby,the difference is now only 68%:

EscapeUtils.escape_url:  3311825.2 i/s
          CGI.escape:  1969841.8 i/s - 1.68x  (± 0.00) slower

Which isn't bad, but is it good enough to justify a gem and some monkey patches?

On the unescape side of things the difference is even smaller:

EscapeUtils.unescape_url:  2941962.7 i/s
        CGI.unescape:  2232433.7 i/s - 1.32x  (± 0.00) slower

So I'm tempted to deprecate and to redirect people to GCI.escape / unescape

@jhawthorn what do you think?