FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

AsciiString::cached should sanitize the provided String · Issue #13749 · netty/netty · GitHub

/ netty Public

AsciiString::cached should sanitize the provided String  #13749

Description

AsciiString::cached is not sanitizing the provided String to match the Latin content into its byte[].
Right now this translate into output errors, but not any functional bug (as far as I can tell), but it prevents using the cached String, while available, to speedup common operations, as explained in https://github.com/netty/netty/pull/13747/files#r1435842167

A typical usage is while users have String-based API (eg for JaxRS,...) wrapping the Netty http headers map and they have to perform any lookup:

  • a fresh new AsciiString::hashCode(String) computation is performed (which we cannot save)
  • the found (if any) AsciiString is compared against the provided String using char-per-char comparisons

The latter operation could be made way faster if the AsciiString::string is a trusted version of the AsciiString content, enabling using String::contentEquals and intimately vectorized/bound-check free equality.

The same approach could be used similarly for the ignore case equality check, leveraging any provided String intrinsic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL