[std.concurrency] prioritySend is 1000 times slower than send?

osa osa at aso.osa
Thu Sep 30 12:17:11 PDT 2010


On 09/30/2010 01:45 PM, Sean Kelly wrote:
> Benchmark: 5944400 iterations in 5 seconds (1.18888e+06/second) -- built without -version=priority
> Benchmark: 4900 iterations in 5.119 seconds (957.218/second) -- build with -version=priority before fix
> Benchmark: 39700 iterations in 5.001 seconds (7938.41/second) -- built with version=priority after fix

Seems to be about an order of magnitude improvement. Not too bad.

> The remaining issue has to do with the fact that the exception is constructed when the send is issued and when this exception is constructed a stack trace is generated as well.  I'll have to modify Throwable so that derived classes can specify that no trace be generated.  That or eliminate constructing the exception at the send site and change how that exception is represented.

I've also thought about switching to 'send' if the receiver queue is 
empty, but there is no way in std.concurrency API to check for that. Is 
there any serious issue with adding such method? I understand that in 
multi-threaded environment an empty queue as told by 'isEmpty' call may 
become non-empty before that fact is used, but in some situations 
approximate result (means empty or almost empty) is fine.


More information about the Digitalmars-d mailing list