in reply to Re^8: OT How fast a cpu to overwhelm Time::HiRes
in thread OT How fast a cpu to overwhelm Time::HiRes

If I drop the number of threads to 10 as shown in your snippet, the context switches goes up to the 860k mark. Drop it to 2, and it averages out at over 1,100,000/s. Both for the empty loop.

Adding back the gettimeofday() and the best I can achieve if 170,000 even with just 2 threads and a single process.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^9: OT How fast a cpu to overwhelm Time::HiRes

Replies are listed 'Best First'.
Re^10: OT How fast a cpu to overwhelm Time::HiRes
by tirwhan (Abbot) on Dec 01, 2005 at 15:45 UTC

    Ah, right, that would be it. Here are the numbers for 100 concurrent processes with fork (the thread measurement above was done with 100 threads).

    Xeon AMD64 single process, empty loop 500,000/s 220,000/s two processes, empty loop 340,000/s 185,000/s single process, gettimeofday 235,000/s 85,000/s two processes, gettimeofday 190,000/s 80,000/s

    Still better than threads for the SMP system, not as good for the single-processor one. Which is as expected, so nothing to see here ;-).


    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan