-
Notifications
You must be signed in to change notification settings - Fork 3
Implement zero-copy ByteString <=> ByteVector conversions #1
Comments
:+1 That would be awesome! |
Step one is done by #2, taking care of composite variants is more complex than I can tackle tonight. Shall we create a more specific ticket for those? (or even one per direction?) |
That sounds good. A ticket per direction might be good -- I've been experimenting with Another thing to note -- the next major release of scodec-bits changes the indexing on |
I’m unfortunately quite overwhelmed with other things now, @rklaehn would you be interested in tinkering with this? |
@rkuhn So basically akka.util.ByteString and scodec.bits.ByteVector are both unbalanced rope-like data structures representing sequences of bytes. And you want a conversion that does not copy the byte arrays in the leafs. Conversion between leafs is already implemented using this java hack to get around accessibility restrictions, right? |
Well, kind of. Currently it “works”, but it avoids the copy only in the compact case. Concerning access restrictions @mpilquist told me that on the scodec end there might be some work needed to make the necessary constructors accessible, even for Java. |
I'm not sure what to do about access restrictions. I don't really want to make the various concrete IIRC, we have a similar issue with |
Yes, this interop library may require more frequent release than normal client code, but that might be worth it. WDYT? |
Works for me, assuming we can avoid exposing internals to scala clients (via package private, java workarounds, etc.). |
@rkuhn Yes, that is what I meant with leafs. The compact ByteString1C is the leaf of your rope data structure, right? It is (currently?) the only implementation of CompactByteString. I am not familiar with the scodec one, but it seems to be roughly similar except for some trickery with mutable buffers... In the long term, wouldn't it be best if akka and scodec could come up with a common ByteString implementation that works for both? |
Well, ideally we would just use ByteString :-) (saying that since Akka is quite a bit older than scodec, but also because we would have quite some difficulty phasing out ByteString given our binary compatibility constraints). But scodec will probably not want to depend on akka-actor and we cannot break ByteString out of that artifact without violating some useful practices (like not splitting packages across multiple artifacts—which is a definite no-go for OSGi [which we unfortunately do support]). What would the migration strategies look like? |
@rkuhn Strangely, I feel that the ideal is that we'd just use In all seriousness though, you are correct that we don't want scodec depending on akka-actor. Also, Internally, the As a result, I think an interop layer is our best bet for the foreseeable future. If folks were interested in SLIP-ing something based on |
No description provided.
The text was updated successfully, but these errors were encountered: