Skip to content

bpo-46041: Add identity comparison micro-optimizations to listobject.c#30036

Closed
tekknolagi wants to merge 2 commits intopython:mainfrom
tekknolagi:mb-micro
Closed

bpo-46041: Add identity comparison micro-optimizations to listobject.c#30036
tekknolagi wants to merge 2 commits intopython:mainfrom
tekknolagi:mb-micro

Conversation

@tekknolagi
Copy link
Contributor

@tekknolagi tekknolagi commented Dec 10, 2021

Add two micro-optimizations similar to
bpo-39425 that avoid reference
counting in the fast path.

https://bugs.python.org/issue46041

Add two micro-optimizations similar to
[bpo-39425](https://bugs.python.org/issue39425) that avoid reference
counting in the fast path.
@iritkatriel
Copy link
Member

Can you show some micro benchmark results where this makes a difference?

It adds a comparison for every element until the equal one, and only saves at most one incref/decref pair per lookup. So it's not a clear win.

@tekknolagi
Copy link
Contributor Author

Sure, let me figure out how to make and run one of those fairly.

@tekknolagi
Copy link
Contributor Author

After some microbenchmarking with pyperf, I cannot find much of a win in this. This only really makes sense in the context of a workload involving a fork, where you want to avoid a CoW. Thanks.

@tekknolagi tekknolagi closed this Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants