[zeromq-dev] P/Invoke-based CLR access to zeroMQ
Martin Sustrik
sustrik at fastmq.com
Mon Feb 23 11:03:41 CET 2009
Dirk,
> Well, the CLR is an amazing piece of technology. Please check the
> attached dnzmq.cs, I think I made the Send function work without
> modifications to the C-API. So all that's needed now would be a receive
> with a allocator callback.
It looks pretty elegant.
> There is just one minor problem: with messages of 512 bytes size, the
> original copy-based implementation is twice as fast as the new one...
:)
This is why I've proposed to use zero-copy only for large messages. On
low layers (like OS kernel) the low limit for messages to be more
effective with zero-copy is somewhere at several kilobytes of size. With
the functionality on higher level of stack, this limit may be even higher.
Once we have a little time we'll give your implementation a try testing
it for different message sizes. Testing it for both zero-copy and copy
algorithms should yield 2 linear graphs. The intersection of the two
lines should be a located at the message size where zero-copy starts to
be more efficient than copy algorithm.
Btw, we've fixed the bugs you've reported and merged the fixes into the
trunk. The only exception is the SCTP-related problem which will take a
some time to fix as we are having problems with SCTP API not being fully
standardised at the moment.
Martin
More information about the zeromq-dev
mailing list