[issue19232] Speed up _decimal import

2014-10-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 75b5617b8dfc by Stefan Krah in branch 'default':
Issue #19232: Fix sys.modules lookup (--without-threads)
https://hg.python.org/cpython/rev/75b5617b8dfc

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2014-09-12 Thread STINNER Victor

STINNER Victor added the comment:

We could speed up the import further by not importing collections
in _decimal.  That could be done once structseq fully implements
the namedtuple protocol (for DecimalTuple).

I suggest to close this issue. I guess that importing decimal is already fast 
enough, and enhance structseq is a completly different issue. (Is there an open 
issue, just to get the link?)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2014-09-12 Thread Stefan Krah

Stefan Krah added the comment:

I'm fine with closing this. The structseq issue is #1820.

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2014-09-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8bf51cf94405 by Stefan Krah in branch 'default':
Issue #19232: Speed up decimal import.  Additionally, since _decimal is
http://hg.python.org/cpython/rev/8bf51cf94405

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2014-09-10 Thread Stefan Krah

Stefan Krah added the comment:

We could speed up the import further by not importing collections
in _decimal.  That could be done once structseq fully implements
the namedtuple protocol (for DecimalTuple).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

I would like to go ahead with this.  As Antoine mentioned, most
people don't diagnose import problems, especially when they compare
Python 2 against Python 3.

As it turns out, the slowdown is even significant in a simple tcpserver
application that starts a Python script.

Another benefit is that it will be possible to import the Python version
easily, e.g. to check error messages (currently _decimal justs displays
the signal in tracebacks).  I've often wanted that myself instead of
going through the import_fresh_module() ordeal.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-14 Thread Stefan Krah

Stefan Krah added the comment:

About IDLE I can't say anything, but I'm not entirely sure if the
PEP-399 import method is easier to understand for users, see e.g.:

http://stackoverflow.com/questions/13194384/instantiate-decimal-class

I get the impression that the posters at first did not even realize
that there *is* an accelerator in Python 3.3, so they had a hard time
debugging the issue.


As for the load time: Personally I don't have any application
that relies on a very short load time, but I wan't to note again
that importing decimal at Python startup actually doubles the
startup time.

So if there are applications that start a new Python script
for each request (e.g. via djb's tcpserver), it could really
matter.


OTOH I don't like moving code around either, so we can wait until
there's a demonstrated need for the speedup.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 OTOH I don't like moving code around either, so we can wait until
 there's a demonstrated need for the speedup.

Keep in mind that people who have startup speed problems aren't
likely to open an issue on the tracker about it, let alone
diagnose it enough to put the blame on decimal.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-13 Thread Mark Dickinson

Mark Dickinson added the comment:

 Mark, Raymond: Would you support the change (__name__ hack and all)?

No objections here.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-13 Thread Stefan Krah

Stefan Krah added the comment:

Antoine Pitrou rep...@bugs.python.org wrote:
 You can apply it using hg import --no-commit, I think.

mercurial 2.1 throws an exception even though the patch was created with
that version.  Now I upgraded to 2.7.2 and it works.

Rietveld also seems to choke on the first patch (no review link).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think we should save these sort of tricks only for modules imported during 
startup.

Ideally, a user should expect that the code for the decimal module is in 
decimal.py.  Ideally, tools like IDLE's Open Module should be able to find 
the source code using only the module name.

I'm -0 on this one.  I don't think hacking up the source tree is worth it.  The 
import is only done once -- the important part is what decimal does when it is 
imported.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-13 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

New submission from Stefan Krah:

As discussed on python-dev, importing _decimal at the bottom of
decimal.py is about 9x slower than importing _decimal directly.

--
assignee: skrah
components: Extension Modules
messages: 199553
nosy: skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: Speed up _decimal import
type: performance
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread STINNER Victor

STINNER Victor added the comment:

I proposed something similar for issue #19229.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Eric V. Smith

Eric V. Smith added the comment:

Remember that one reason for importing the C version at the bottom of the 
python version is so that alternate implementations (PyPy, IronPython, Jython) 
could provide partial versions of the C (or equivalent) versions. By importing 
after the Python version, the alternate implementation could continue to use 
parts of the Python code.

I think the impact on alternate implementations needs to be considered before 
we start rearchitecting these imports.

--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
keywords: +patch
Added file: http://bugs.python.org/file32060/issue19232.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Stefan Krah added the comment:

Right, let's start collecting objections. :)

Mark, Raymond: Would you support the change (__name__ hack and all)?


Maciej: Is this approach a problem for PyPy?

--
nosy: +fijall, mark.dickinson, rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
stage: needs patch - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread STINNER Victor

STINNER Victor added the comment:

If the Python implementation is renamed to _pydecimal, I don't expect it to be 
used in CPython. I never used _pyio in a real application, only for some tests 
to debug. I don't think that we need the __name__ = 'decimal' hack. If you 
really want to keep it, please add at least a comment explaining it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Stefan Krah added the comment:

I guess if some of the pickling stuff get's rewritten, we can drop
__name__.

The other thing is that traditionally the types were decimal.Decimal
etc., so I'm not sure if it is good idea to have _decimal.Decimal and
_pydecimal.Decimal.

Of course adding __module__ everywhere is another option.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread STINNER Victor

STINNER Victor added the comment:

 The other thing is that traditionally the types were decimal.Decimal
 etc., so I'm not sure if it is good idea to have _decimal.Decimal and
 _pydecimal.Decimal.

Why not renaming the _decimal module to decimal?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Stefan Krah added the comment:

_decimal already lies about its name (for pickling).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Stefan Krah

Stefan Krah added the comment:

I can't apply the patch that was created with diff --git, so here is
another one that is less readable but applies.

--
Added file: http://bugs.python.org/file32066/issue19232-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19232] Speed up _decimal import

2013-10-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I can't apply the patch that was created with diff --git, so here is
 another one that is less readable but applies.

You can apply it using hg import --no-commit, I think.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19232
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com