Uploaded image for project: 'ProtoStream'
  1. ProtoStream
  2. IPROTO-129

ProtobufUtil.fromWrappedByteArray should not create a ByteArrayInputStream

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.6.Final, 4.3.3.Final
    • 4.2.5.Final, 4.3.2.Final
    • None
    • None

      ProtobufUtil.fromWrappedByteArray wraps the bytep[] in a ByteArrayInputStream and uses that as an input for CodedInputStream. But that is inefficient, because CodedInputStream.StreamDecoder needs to allocate a buffer and copy from the stream into the buffer before processing.

      Instead we can pass the byte[] directly to CodedInputStream and use CodedInputStream.ArrayDecoder, which doesn't need a buffer.

            dberinde@redhat.com Dan Berindei (Inactive)
            dberinde@redhat.com Dan Berindei (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: