Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3656

ResteasyJackson2Provider excessive byte[] copies

XMLWordPrintable

      Jackson usually configure different form of buffer pooling (see https://github.com/FasterXML/jackson-core/blob/e19615bb99f6127230793e2c7766bbb3beaee6fc/src/main/java/com/fasterxml/jackson/core/io/IOContext.java#L63) and perform a single write(byte[] b, int offset, int lengh) vs the provided output stream during serialization, using its internally pooled buffer.

      In short, this enable an async write to:

      • expect a single encoded byte[]
      • size the receiver output stream exactly to it
      • save the additional copy for the async completion to happen

      This is just an idea as the subsequent AsyncOutputStream ::asyncWrite can "backfire" performing an additional copy, see 3408cf1

      see

              jperkins-rhn James Perkins
              fnigro Francesco Nigro
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: