Skip to content

port CGI.escapeHTML optimization #5937

@ahorek

Description

@ahorek

one of the recent ruby 2.7 optimization is ruby/ruby#2226

jruby is a bit behind

ruby 2.7 dev
      CGI.escapeHTML      2.614k (± 9.3%) i/s -     13.108k in   5.065551s

ruby 2.5.3
      CGI.escapeHTML    761.177  (± 6.7%) i/s -      3.825k in   5.050563s

jruby 9.2.9.0 dev
      CGI.escapeHTML    224.765  (± 6.7%) i/s -      1.122k in   5.013482s

the previous java port is at

optimized_escape_html(Ruby runtime, RubyString str) {

porting the new algorithm should improve numbers

the optimization is especially important for rails, erb engine does use it for html escaping:
https://api.rubyonrails.org/classes/ERB/Util.html#method-c-h

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions