I'm modelling a small simulator, the simulator is implemented with a state machine that handle the event queue and with a scheduler that schedule new events. Another feature that the simulator have to handle is the accounting of various times. At the moment the times are kept away from the state of the state machine in a few global references that are updated when needed, because I thought that ref update is faster than passing these time across functions. I've written a small test that benchmark performance of passing argument between funcions vs. keep them in global reference (code attached). Surprisingly passing argument is really faster than update them through references, look at this: $ time ./a.out 1000000000 ref 1000000001 real 0m24.382s user 0m12.000s sys 0m0.000s $ time ./a.out 1000000000 arg 1000000001 real 0m5.317s user 0m2.660s sys 0m0.000s Are these tests realistic or I am missing something? Cheers! -- Stefano "Zack" Zacchiroli ICQ# 33538863 Home Page: http://www.cs.unibo.it/~zacchiro Undergraduate student of Computer Science @ University of Bologna, Italy - Information wants to be Open -