KEMBAR78
[mypyc] Add fast path for simple calls in wrapper functions by JukkaL · Pull Request #9948 · python/mypy · GitHub
Skip to content

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jan 23, 2021

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)

@JukkaL JukkaL merged commit f2a4272 into master Jan 23, 2021
@JukkaL JukkaL deleted the vectorcall-2.1 branch January 23, 2021 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant