[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-12 Thread STINNER Victor
STINNER Victor added the comment: @Andrei: Ping? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19515 ___ ___ Python-bugs-list mailing list

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-12 Thread Andrei Dorian Duma
Andrei Dorian Duma added the comment: Removed _Py_IDENTIFIERs duplicated in the same file, except: _Py_IDENTIFIER(replace): Modules/zipimport.c:563 which was enclosed in some #ifdefs. -- keywords: +patch Added file:

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-12 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19515 ___

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 518e3b174120 by Victor Stinner in branch 'default': Issue #19515: Remove identifiers duplicated in the same file. http://hg.python.org/cpython/rev/518e3b174120 -- ___ Python tracker

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset d2209b9f8971 by Victor Stinner in branch 'default': Issue #19515: Remove duplicated identifiers in zipimport.c http://hg.python.org/cpython/rev/d2209b9f8971 -- ___ Python tracker rep...@bugs.python.org

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-08 Thread Martin v . Löwis
Martin v. Löwis added the comment: I'd be +0 on extracting common identifiers. I see a slight increase of readability, and expect a slight reduction of memory usage, and a tiny reduction in runtime. It's not really worth the effort, but I fail to see that it causes harm. I see no point in

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-08 Thread STINNER Victor
STINNER Victor added the comment: 2013/11/8 Martin v. Löwis rep...@bugs.python.org: I'd be +0 on extracting common identifiers. I (...) expect a slight reduction of memory usage, and a tiny reduction in runtime. Only duplicated Py_IDENTIFIER structures would be removed in memory, but these

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +andrei.duma, loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19515 ___ ___

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: If most identifiers are stored in the same place, it would become possible to have a cleanup function to clear all identifiers. Such function could be called at Python shutdown to release as much memory as possible. --

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: What are you trying to achieve exactly? I don't think sharing identifier structs will gain anything significant. Please don't make the source code less readable in search for some mythical efficiency. -- nosy: +pitrou

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Martin v . Löwis
Martin v. Löwis added the comment: Victor: There already *is* a cleanup function that clears all allocated identifier memory at interpreter shutdown. Please read the source. -- ___ Python tracker rep...@bugs.python.org

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: Victor: There already *is* a cleanup function that clears all allocated identifier memory at interpreter shutdown. Please read the source. Oh, great! I never noticed _PyUnicode_ClearStaticStrings(). Call trace: Py_Finalize() -

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Martin v . Löwis
Martin v. Löwis added the comment: Well, that was one of the motivations of introducing this Py_IDENTIFIER machinery: to be able to cleanup at the end (unlike the static variables that were used before, which couldn't be cleaned up). -- ___ Python

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: Antoine, Martin: So, what do you think? Is it worth to move most common identifiers to a single place to not duplicate them? If identifiers are already cleared at exit, the advantage would be to initialize duplicated identifiers more quickly, and don't

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Antoine, Martin: So, what do you think? Is it worth to move most common identifiers to a single place to not duplicate them? Well, worth what? :) If you don't tell us what it brings (numbers?), I'm against it. --

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: If you don't tell us what it brings (numbers?), I'm against it. For performances, it's probably very close to zero speed up. For the memory, it's a few bytes per duplicated identifier. -- ___ Python tracker

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: If you don't tell us what it brings (numbers?), I'm against it. For performances, it's probably very close to zero speed up. For the memory, it's a few bytes per duplicated identifier. Well, then IMHO it's not worth it. --

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: Well, then IMHO it's not worth it. Ok, you are probably right :-) @Andrei: Are you interested to work on a patch to remove identifiers duplicated in the same file? -- ___ Python tracker rep...@bugs.python.org

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Andrei Dorian Duma
Andrei Dorian Duma added the comment: @Andrei: Are you interested to work on a patch to remove identifiers duplicated in the same file? Yes, I will provide a patch in a day or two. -- ___ Python tracker rep...@bugs.python.org

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread STINNER Victor
STINNER Victor added the comment: New changeset 01c4a0af73cf by Victor Stinner in branch 'default': Issue #19512, #19515: remove shared identifiers, move identifiers where they http://hg.python.org/cpython/rev/01c4a0af73cf This changeset removes some identifiers duplicated in the same file.

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset 01c4a0af73cf by Victor Stinner in branch 'default': Issue #19512, #19515: remove shared identifiers, move identifiers where they http://hg.python.org/cpython/rev/01c4a0af73cf -- nosy: +python-dev ___

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-06 Thread STINNER Victor
New submission from STINNER Victor: I started to share some common identifiers in Python/pythonrun.c, extract: /* Common identifiers */ _Py_Identifier _PyId_argv = _Py_static_string_init(argv); _Py_Identifier _PyId_builtins = _Py_static_string_init(builtins); ... Do you think it would be

[issue19515] Share duplicated _Py_IDENTIFIER identifiers in C code

2013-11-06 Thread STINNER Victor
STINNER Victor added the comment: _Py_IDENTIFIER(__delitem__): Objects/typeobject.c:5132 _Py_IDENTIFIER(__delitem__): Objects/typeobject.c:5183 I moved this one to #19514. -- ___ Python tracker rep...@bugs.python.org