On 12 Oct 2013 05:49, "Eric Snow" wrote:
>
> On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote:
> > Antoine Pitrou wrote:
> >> Just create a _pydecimal module (like _pyio).
> >
> > That's very fast indeed. There's one minor problem: For backwards
compatibility
> > and pickling [1] I'd need to a
2013/10/11 Antoine Pitrou :
>> So the first step I tried is something horrible (typing from memory):
>>
>> try:
>> import _decimal
>> except ImportError:
>>
>> else:
>> from _decimal import *
>>
>> That way the 2.21 msec are reduced to 912 usec, but the indentation is
>> an abomination
On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote:
> Antoine Pitrou wrote:
>> Just create a _pydecimal module (like _pyio).
>
> That's very fast indeed. There's one minor problem: For backwards
> compatibility
> and pickling [1] I'd need to add
>
> __module__ = 'decimal'
>
> to every class
Antoine Pitrou wrote:
> Just create a _pydecimal module (like _pyio).
That's very fast indeed. There's one minor problem: For backwards compatibility
and pickling [1] I'd need to add
__module__ = 'decimal'
to every class of the Python version. Are there any reasons not to do that?
Stefan
Le Fri, 11 Oct 2013 17:01:35 +0200,
Stefan Krah a écrit :
>
> I'm getting about the same values as above. I may be misunderstanding
> something, but I wanted to reduce the difference between the 2.21 msec
> and the 112 usec.
So you aren't complaining about C extension import time, but Python
cod
Antoine Pitrou wrote:
> Try the following:
>
> $ ./python -m timeit -s "modname='decimal'; import sys" \
> "__import__(modname); del sys.modules[modname]"
> 1000 loops, best of 3: 2.21 msec per loop
>
> $ ./python -m timeit -s "modname='_decimal'; import sys" \
> "__import__(modname); del sy
Le Fri, 11 Oct 2013 14:24:29 +0200,
Stefan Krah a écrit :
> Hi,
>
> recently there has been some talk about reducing import times. It
> seems that the current import strategy for C extensions (i.e.
> importing the extension at the bottom of the .py file) is quite slow:
>
>
> ===
Stefan Krah wrote:
> import sys
>
> for i in range(1):
> import decimal
> del sys.modules('decimal')
> del sys.modules('_decimal')
^^^
This happens when a Linux user is forced to use Putty :(
___
Python-Dev mailing