[Ns-developers] Packet::PeekData

Mathieu Lacage mathieu.lacage at cutebugs.net
Sat Mar 31 09:21:25 PDT 2012


On 03/31/2012 05:48 PM, Claudio Freire wrote:
>
> Someone kindly reminded me that Packet::PeekData has been deprecated forever
> but is still around. I feel no rush to remove it _now_ but it is on my TODO
> so, if someone cares about it, and thinks that its replacement
> Packet::CopyData is really not sufficient, now would be the time to raise
> this, before I commit the patch that removes it.
> I'm thinking performance could suffer by abusing of CopyData.

For most people, no, because PeekData will trigger a buffer reallocation 
which is much more costly than a mere memcpy. PeekData is evil from a 
performance perspective and a nightmare to implement. So, users who care 
about performance, should give CopyData a try and let us know how it 
works for them. If they do not speak up now, well, we can deal with 
their problems later but it will be without PeekData.

>
> All this *could* be helped by COW buffers.

You mean, the kind we already have but do not expose in the API :) I 
doubt it would help because most users of the PeekData/CopyData code use 
it because they need to interoperate with external code that has its own 
buffer management API.

Mathieu



More information about the Ns-developers mailing list