mypy
f2a42720 - [mypyc] Add fast path for simple calls in wrapper functions (#9948)

Commit
5 years ago
[mypyc] Add fast path for simple calls in wrapper functions (#9948) Add specialized argument parsing functions for these simple signatures: 1. No arguments 2. Single argument 3. No keyword-only args, *kwargs or **kwargs The latter case covers many typical functions, such as these: ``` def f(x: int, y: int) -> int: ... def g(x: int = 0) -> str: ... ``` The new parsing functions take a fast path when the caller passes only positional arguments. This speeds up wrapper functions a lot in simple calls. Microbenchmark speedups: * `positional_args_from_interpreted` is 1.5x faster (now faster than interpreted) * `nested_func` is 1.5x faster * `sorted_with_key` is 14% faster (now faster than interpreted)
Author
Parents
Loading