Closed casperisfine closed 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:
EscapeUtils.escape_url
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%:
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
GCI.escape / unescape
@jhawthorn what do you think?
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 thanGCI.escape
:But running the benchmark on a modern Ruby,the difference is now only
68%
: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:
So I'm tempted to deprecate and to redirect people to
GCI.escape / unescape
@jhawthorn what do you think?