eolivelli commented on pull request #9448: URL: https://github.com/apache/pulsar/pull/9448#issuecomment-788852790
@sijie > Why not implement Source<ByteBuf> or Source<ByteBuffer>? I am not sure we can save a memory copy this way. In the end we have to return a byte[] during `Schema#encode` https://github.com/apache/pulsar/blob/c01b1eeda3221bdbf863bf0f3f8373e93d90adef/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java#L72 The ByteBuffer we could return is pointing to a non-zero offset on the original array (we are skipping the magic number and the schema id), so we cannot re-use the same array and we will end-up in perform a copy. https://github.com/apache/pulsar/blob/cd259a443625dfa0710e79a87de65fd11b85d5bc/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ByteBufferSchema.java#L58 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
