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

Optimise append/pop for non-lists #2850

scoder opened this Issue Feb 17, 2019 · 1 comment


None yet
1 participant
Copy link

scoder commented Feb 17, 2019

Found through CPython's micro benchmark script:

With all CYTHON_* optimisation macros enabled (default):

  20.7 ns       list_append_pop
 155.4 ns       deque_append_pop

When disabled:

  66.4 ns       list_append_pop
  75.1 ns       deque_append_pop

For non-lists, this is slow even when compared to CPython 3.8:

  61.6 ns       list_append_pop
  53.9 ns       deque_append_pop

@scoder scoder added this to the 3.0 milestone Feb 17, 2019

@scoder scoder closed this in 459a519 Feb 17, 2019


This comment has been minimized.

Copy link
Contributor Author

scoder commented Feb 17, 2019

Fixed by avoiding the tuple packing and method calls in Py3.7+:

  20.0 ns       list_append_pop
  45.5 ns       deque_append_pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.