[swift-server-dev] Byte Bucket Protocol

Chris Bailey BAILEYC at uk.ibm.com
Thu Nov 3 15:46:05 CDT 2016


> 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.

Which is something that Foundation itself has to do for URLSession - I 
think its a pretty direct mapping, but there would be wider benefits of 
solving that issue.




From:   Helge Heß via swift-server-dev <swift-server-dev at swift.org>
To:     Swift Server Dev <swift-server-dev at swift.org>
Date:   03/11/2016 20:39
Subject:        Re: [swift-server-dev] Byte Bucket Protocol
Sent by:        swift-server-dev-bounces at swift.org



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.

hh

_______________________________________________
swift-server-dev mailing list
swift-server-dev at swift.org
https://lists.swift.org/mailman/listinfo/swift-server-dev



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20161103/af8fb8ca/attachment.html>


More information about the swift-server-dev mailing list