John Wang wrote:
1 thread: 445 ms.
2 threads: 870 ms.
5 threads: 2200 ms.

Pretty much the same numbers you'd get if you are running them sequentially.

Any ideas? Am I doing something wrong?

If you're performing compute-bound work on a single-processor machine then threading should give you no better performance than sequential, perhaps a bit worse. If you're performing io-bound work on a single-disk machine then threading should again provide no improvement. If the task is evenly compute and i/o bound then you could achieve at best a 2x speedup on a single CPU system with a single disk.


If you're compute-bound on an N-CPU system then threading should optimally be able to provide a factor of N speedup.

Java's scheduling of compute-bound theads when no threads call Thread.sleep() can also be very unfair.

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to