Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/266#issuecomment-39646924
@pwendell As I saw it, the reason it was used was for the ability to access
the internal `byte[]` buffer directly rather than a copy. However in 2 of 3
cases, it ended up copying anyway (the call to `trim()`). The third case was in
`Serializer.scala`, in `SerializerInstance.serializeMany`. But even there, I
think the copying of the `byte[]` is offset by the fact that it can be merely
`wrap()`ed by a `ByteBuffer` and avoids `ByteBuffer.allocate()` -- another copy
in disguise. From my read, that was the potential difference, and I don't think
there ends up being a meaningful difference. I can't say I'm 100% certain, but
feel pretty sure.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---