Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python.args usage and optimize call_python #183

Closed
wants to merge 2 commits into from

Conversation

guidanoli
Copy link
Contributor

Closes #182

@scoder
Copy link
Owner

scoder commented Apr 29, 2021

You say that this optimises the call. So, how much faster is it?

lupa/_lupa.pyx Outdated Show resolved Hide resolved
@guidanoli
Copy link
Contributor Author

You say that this optimises the call. So, how much faster is it?

It's trivial to understand that this is faster. There's no need for benchmarking it.

Before:

  • has to check every argument to see it is a _PyArguments instance (O(n))
  • has to merge O(n) dictionaries
  • has to concatenate O(n) tuples

After:

  • has to check only the last argument (O(1))
  • there is either 1 dictionary or none
  • pre-allocates 1 tuple of right size for all positional arguments

@guidanoli
Copy link
Contributor Author

See #187 for updated changes

@guidanoli guidanoli closed this Jul 16, 2021
@guidanoli guidanoli deleted the feat/better-args branch July 16, 2021 16:19
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.

The usage of python.args is inconsistent with Lua varargs semantics
2 participants