Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3475

[perf] Improve performance of HtmlResponseWriterImpl constructor

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.0.12, 2.1.6
    • 2.0.13, 2.1.7
    • None
    • None

    Description

      HtmlResponseWriterImpl is a very light object created many times. But its constructor uses a memory intensive test if character encoding is valid:

      // validates the encoding, it will throw an UnsupportedEncodingException if the encoding is invalid
      try

      { new String("myfaces".getBytes(), characterEncoding); }

      catch (UnsupportedEncodingException e)

      { throw new IllegalArgumentException("Unsupported encoding: "+characterEncoding); }

      this code is number 1. of byte [] allocations in my tests.

      We can probably remove this check entirely: a exception will be thrown a few moments later if encoding is not supported

      Review other code in constructor too - it must be fast as possible.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            markoc50 Martin Kočí
            markoc50 Martin Kočí
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment