[issue46953] use FASTCALL for __import__ builtin

2022-03-12 Thread Kumar Aditya
Change by Kumar Aditya : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue46953] use FASTCALL for __import__ builtin

2022-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the advantage of not touching a stable code? It was never a performance critical part of the code. This is why it avoided multiple previous optimizations. It is still use PyArg_ParseTupleAndKeywords(). Of course now, when optimization is provided

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Mark Shannon
Mark Shannon added the comment: Serhiy, what is the advantage of __import__ being slower? Not counting the argument clinic generated code, the PR doesn't add any code and improves the docstring. -- ___ Python tracker

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The recommended way is to use importlib.import_module(). -- ___ Python tracker ___ ___

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Kumar Aditya
Kumar Aditya added the comment: Occurrence of __import__ calls in stdlib: grep __import__ Lib/*/*.py | wc -l 28 It is common to import directly via __import__ outside the stdlib too. -- ___ Python tracker

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Kumar Aditya
Kumar Aditya added the comment: The PR uses argument clinic and not hand written parsing code, which in turn is faster. -- ___ Python tracker ___

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: __import__() usually is not called directly, and in common case (when it is not overridden) the overhead of the call is avoided completely in the import statement. And in non-trivial case, it would only save 80 microseconds if you import 1000 modules. I

[issue46953] use FASTCALL for __import__ builtin

2022-03-07 Thread Kumar Aditya
New submission from Kumar Aditya : Use FASTCALL for __import__ builtin. Benchmark: -- import pyperf runner = pyperf.Runner() runner.timeit(name="bench __import__", stmt="__import__('asyncio')"