[issue26098] PEP 510: Specialize functions with guards

2017-06-23 Thread STINNER Victor
STINNER Victor added the comment: Recently, some people asked me for an update for my FAT Python project. So I rebased this change I wrote 1 year 1/2 and adapted it for the new code base: * I renamed test_pep510.py to test_func_specialize.py * I removed the useless PyFunction_Check() macro * I

[issue26098] PEP 510: Specialize functions with guards

2017-06-23 Thread STINNER Victor
Changes by STINNER Victor : -- pull_requests: +2400 ___ Python tracker ___ ___

[issue26098] PEP 510: Specialize functions with guards

2017-05-29 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___

[issue26098] PEP 510: Specialize functions with guards

2016-02-05 Thread STINNER Victor
STINNER Victor added the comment: Oh, I missed comments on the code review. Fixed on patch version 8. -- Added file: http://bugs.python.org/file41818/specialize-8.patch ___ Python tracker

[issue26098] PEP 510: Specialize functions with guards

2016-02-05 Thread STINNER Victor
STINNER Victor added the comment: Patch version 7: * Fix a random crash related to _testcapi.PyGuard: implement tp_traverse on PyFuncGuard and "inherit" tp_traverse on PyGuard * Fix a typo Include/funcobject.h * (rebase the patch) -- Added file:

[issue26098] PEP 510: Specialize functions with guards

2016-02-02 Thread STINNER Victor
STINNER Victor added the comment: Patch version 6: I inlined PyFunction_GetSpecializedCode() into fast_function() of Python/ceval.c. It reduces *a little bit* the overhead of the patch when specialization is not used, but it also avoids to expose this function. I don't think that it's worth

[issue26098] PEP 510: Specialize functions with guards

2016-02-02 Thread STINNER Victor
STINNER Victor added the comment: Results of the "The Grand Unified Python Benchmark Suite" on specialize-6.patch. I'm skeptical, I don't understand how my patch can make a benchmark faster :-) The result of regex_v8 is bad :-/ $ python3 -u perf.py --rigorous ../default/python.orig

[issue26098] PEP 510: Specialize functions with guards

2016-01-27 Thread STINNER Victor
STINNER Victor added the comment: FIXME: sys.getsizecode(func) doesn't include specialized code and guards. -- ___ Python tracker ___

[issue26098] PEP 510: Specialize functions with guards

2016-01-27 Thread STINNER Victor
STINNER Victor added the comment: Patch version 5: implement PyFunction_RemoveSpecialized() and PyFunction_RemoveAllSpecialized() functions (with unit tests!). I'm not sure that PyFunction_RemoveSpecialized() must return 0 (success) if the removed specialized code doesn't exist (invalid

[issue26098] PEP 510: Specialize functions with guards

2016-01-23 Thread STINNER Victor
STINNER Victor added the comment: Patch version 4: * Keywords are now supported everywhere and tested by unit tests * Inline specode_check() into PyFunction_GetSpecializedCode() -- Added file: http://bugs.python.org/file41702/specialize-4.patch ___

[issue26098] PEP 510: Specialize functions with guards

2016-01-19 Thread STINNER Victor
STINNER Victor added the comment: Patch version 3: * guards are now tracked by the garbage collector. That's a very important requirements to not change the Python semantics at exit, when a guard keeps a strong reference to the global namespace:

[issue26098] PEP 510: Specialize functions with guards

2016-01-13 Thread STINNER Victor
New submission from STINNER Victor: Attached patch implements the PEP 510 "Specialize functions with guards". Changes on the C API are described in the PEP: https://www.python.org/dev/peps/pep-0510/#changes Additions of the patch: * Add func_specialize() and func_get_specialized() to

[issue26098] PEP 510: Specialize functions with guards

2016-01-13 Thread STINNER Victor
STINNER Victor added the comment: An unit test is needed on pickle serialization to ensure that the specialize code and guards are ignored. -- ___ Python tracker

[issue26098] PEP 510: Specialize functions with guards

2016-01-13 Thread STINNER Victor
STINNER Victor added the comment: Patch version 2 fixes some bugs and add more tests. More notes about the patch: * RuntimeError is raised if guard check() result is greater than 2 * RuntimeError is raised if guard init() result is greater than 1 * (hum, maybe 'res < 0' check must be replaced