You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/11/19 18:35:02 UTC
[GitHub] [pulsar-dotpulsar] sunero4 commented on pull request #128: Reduce allocations by not copying ReadOnlySequence
sunero4 commented on PR #128:
URL: https://github.com/apache/pulsar-dotpulsar/pull/128#issuecomment-1320942559
It seems like I was a bit too trigger-happy with the pull request after all, and should have read the [documentation](https://learn.microsoft.com/en-us/dotnet/standard/io/buffers#readonlysequencet) for consuming `ReadOnlySequence` a bit closer :) Apparently `Slice` advances the enumerator of the `ReadOnlySequence`, making it unusable later on, and the correct way of consuming it is in fact to materialize it as an array or using the `SequenceReader<byte>`.
The documentation does however advise against using the `ToArray` method in hot paths, so I might try and play around with using an `ArrayPool` instead. For now I'll decline the PR :)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org