On Fri, 20 Aug 2010, Roman Haefeli wrote:
On Fri, 2010-08-20 at 16:36 +0200, Jack wrote:
I have already do that with [packOSC]/[unpackOSC] and [udpsend]/[udpreceive], it is slow too. I need to send 20000 lists of 3 floats (id, pos x, pos y) each frame (50 fps) from one process to other.
It seems to me as you were creating a lot of overhead for tranmitting only 3 floats. First there is the OSC overhead per message, then each OSC message is sent over UDP, while adding some datagram overhead. By sending 20'000 or even 60'000 floats per message, you could drastically reduce the OSC and UDP protocol overhead. Don't know if this is the real reason for being so slow, but I'd try to reformat your messages. Also, this would probably mean using less computing power for creating all those messages and packets.
Yes, and if you have to respect some limit on the packet size, then the ideal way to split it is in equal parts. So if the number is exactly 20000 triplets, try 100 triplets (12 bytes per triplet gives 1200 bytes) per packet : it will reduce the overhead of single triplet packets by 99%. That means 200 packets per frame.
But it would be more efficient if [pd~] had a transparent message-passing interface based on mmap() or equivalent.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801