[Q]python thread speedup?

Seung-won Hwang shwang5 at students.uiuc.edu
Sat Aug 18 00:44:02 CEST 2001


Recently, I modified serial source routine to multiple-threaded version. The
list is divided into the same size of sub-lists and each sub-list is
assigned to each thread. Then, each thread returns the top object from the
sub-list it has and the top results from threads are merged.

To my surprise, multi-threaded version gave me as much as x4 speedup.
Considering that each thread just looks up array and does some computation,
I don't see significant thread blocking and thus expected that the
context-switch cost would dominate the performance gain..
I'd appreciate any comments that possibly explain this speedup.


More information about the Python-list mailing list