[Python-Dev] SIGCHECK() in longobject.c
dickinsm at gmail.com
Sun Oct 18 22:08:27 CEST 2009
On Sun, Oct 18, 2009 at 9:01 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> In Objects/longobject.c, there's the SIGCHECK() macro which periodically checks
> for signals when doing long integer computations (divisions, multiplications).
> It does so by messing with the _Py_Ticker variable.
> It was added in 1991 under the title "Many small changes", and I suppose it was
> useful back then.
> However, nowadays long objects are ridiculously fast, witness for example:
> $ ./py3k/python -m timeit -s "a=eval('3'*10000+'5');b=eval('8'*6000+'7')"
> 1000 loops, best of 3: 1.47 msec per loop
> Can we remove this check, or are there people doing million-digits calculations
> they want to interrupt using Control-C ?
Yes, I suspect there are. Though you don't need millions of digits for a single
operation to take a noticeable amount of time: try str(10**100000),
Is there a benefit to removing the check?
More information about the Python-Dev