[issue22676] Creating the string representation of a module is slower
Georg Brandl added the comment: HasAttr would just call GetAttr and discard the exception. @ OP: what objects are you pickling? You can give them a __module__ attribute to save the lookup in sys.modules. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22676 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22676] Creating the string representation of a module is slower
Brett Cannon added the comment: In Python 3.3 the import machinery changed to use importlib. This means the code to create the representation of a module now calls into Python code (the `frozen importlib._bootstrap:690(_module_repr)` you're seeing). But my question is why are you not calling PyObject_HasAttr() before calling PyObject_GetAttr()? Exceptions may be relatively cheap but they are not free. -- nosy: +brett.cannon status: open - pending title: _pickle.c - Creating the string representation of a module is slower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22676 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22676] Creating the string representation of a module is slower
kbengine added the comment: This is a misunderstanding, getattribute (PyObject *obj, PyObject *name, int allow_qualname) is the Python code, in the Python/Modules/_pickle.c (1538). Do efficiency is decreased a lot. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22676 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com