[erlang-questions] how much time required to pass messages.

Carsten Schultz carsten@REDACTED
Sun Mar 29 12:48:32 CEST 2009


Vikrant schrieb:
> 
> 26> tokenring:tokenring(10000,1).
> Time required to pass message 10000 times=3.00000 (4.40000) microsecond
> .ok
> 27> tokenring:tokenring(20000,1).
> Time required to pass message 20000 times=3.00000 (4.65000) microsecond
> .ok
> 28> tokenring:tokenring(30000,1).
> Time required to pass message 30000 times=3.33333 (4.63333) microsecond
> .ok
> 
> (time in bracket is system time and time outside bracket is user time in
> microseconds.)
> 
> This is surprising to me! I expected that time required to pass token
> along N processes should be proportional to N!

My guess here is that the resultion of the timer is 1/3.  So your
results are 9, 9, 10.  Considering that these are rounded and that your
function will have a constant term, these numbers are just to small to
allow you to deduce much about your runtime function.  Change the second
parameter into, say, 1000000 in all cases and see what happens.

-- 
Carsten Schultz (2:38, 33:47)
http://carsten.codimi.de/
PGP/GPG key on the pgp.net key servers,
fingerprint on my home page.



More information about the erlang-questions mailing list