On 22/01/2010 11:50, Mark Dickinson wrote:
On Jan 22, 11:11 am, Robin Becker<ro...@reportlab.com>  wrote:
Does using the decimal module incur a penalty because it imports threading or do
I have to actually start a thread?

There is at least one threading-related performance penalty that
doesn't involve the user actually starting a thread: any arithmetic
operation without an explicitly specified context (e.g., as invoked by
one of the standard arithmetic operators) has to make a call to
threading.local() to look up the current (thread-local) context.

I don't know offhand whether this penalty is significant for the
Python version of decimal, though it definitely *is* significant for
decimal-in-C rewrite that's in the works:  it would be interesting to
do some timings against a thread-unaware version of decimal.py.

--
Mark

I guess I was more worried that the import might start the per thread instruction count check even though I'm in a single thread process.
--
Robin Becker

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to