Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce StringEscapeHelper escape and unescape allocations #46

Merged
merged 1 commit into from
Jun 7, 2019
Merged

Reduce StringEscapeHelper escape and unescape allocations #46

merged 1 commit into from
Jun 7, 2019

Commits on Jun 4, 2019

  1. Reduce StringEscapeHelper escape and unescape allocations

    Motivation:
    
    * StringEscapeHelper allocates StringBuilder of default size (16) so there's a good chance it will either be too large, or too small and reallocate underlying char array.
    * escaped always allocate StringBuilder, even when there's nothing to escape in the input String.
    
    Modifications:
    
    * Set StringBuilder initial capacity
    * lazy allocate escape's StringBuilder
    
    Result:
    
    Less allocations.
    slandelle committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    45a207f View commit details
    Browse the repository at this point in the history