Optimize CGI.escapeHTML by reducing buffer extension
and switch-case branches.
Buffer allocation optimization using ALLOCA_N would be the main benefit of patch. It eliminates the O(N) buffer extensions.
ALLOCA_N
It also reduces the number of branches using escape table like https://mattn.kaoriya.net/software/lang/c/20160817011915.htm.
Closes: https://github.com/ruby/ruby/pull/2226
Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org Co-authored-by: Yasuhiro MATSUMOTO mattn.jp@gmail.com
Optimize CGI.escapeHTML by reducing buffer extension
and switch-case branches.
Buffer allocation optimization using
ALLOCA_Nwould be the mainbenefit of patch. It eliminates the O(N) buffer extensions.
It also reduces the number of branches using escape table like
https://mattn.kaoriya.net/software/lang/c/20160817011915.htm.
Closes: https://github.com/ruby/ruby/pull/2226
Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org
Co-authored-by: Yasuhiro MATSUMOTO mattn.jp@gmail.com