[swift-server-dev] Byte Bucket Protocol

Helge Heß me at helgehess.eu
Thu Nov 3 15:39:08 CDT 2016

On 3 Nov 2016, at 21:27, Chris Bailey <BAILEYC at uk.ibm.com> wrote:
> > BTW: Something I consider important to discuss across all areas of interest (crypto, sockets, HTTP) is a protocol to represent a chunks of bytes and chunks of chunks of bytes (buckets and brigades in Apache terms). Of course that could be just NSData or DispatchData but I expect that some frameworks have their own way to represent such buffers, hence a protocol would be nice.
> > Why important? Well, because there needs to be a way to pass the data between those components w/o copying it :-) 
> I think Data/NSData probably makes most sense here, because the data is likely to be passed from the frameworks onto wider sets of packages, which are likely to use NSData - so the overall consistency reduces the overhead of copying and/or translating data types etc. 
> That said, there's some performance work that I know needs doing in Data/NSData, which means frameworks that use their own data types are (today) faster in that area.

Well, GCD is already an example which does not use NSData but DispatchData. So if everything else is based on NSData, a GCD client would need to map/copy the DispatchData into an NSData.

Hence my suggestion to come up with a protocol for this which works for both (and more). It likely wouldn’t be very complex. Get the number of buckets in a brigade, the size, a pointer to the data.


More information about the swift-server-dev mailing list