Message passing between threads: Java 4 times faster than D

Martin Nowak dawg at dawgfoto.de
Thu Feb 9 11:57:57 PST 2012


On Thu, 09 Feb 2012 16:44:46 +0100, Sean Kelly <sean at invisibleduck.org>  
wrote:

> So a queue per message type?  How would ordering be preserved? Also, how  
> would this work for interprocess messaging?  An array-based queue is an  
> option however (though it would mean memmoves on receive), as are  
> free-lists for nodes, etc.  I guess the easiest thing there would be a  
> lock-free shared slist for the node free-list, though I couldn't weigh  
> the chance of cache misses from using old memory blocks vs. just  
> expecting the allocator to be fast.

I didn't yet got around to polish my lock-free SList/DList implementations,
but mutexes should only become a problem with high contention when you  
need to block.
You'd also would need some kind of blocking for lock-free lists.

Best first order optimization would be to allocate the list node  
deterministically.
The only reason to use GC memory for them is that mallocating is still too  
cumbersome.
Nodes are unshared so you'd want a unique_pointer.


More information about the Digitalmars-d mailing list