Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Jan 15, 2024

An idea to fix #7717, only compute the ops dict when needed, when first calling eval, and functools.lru_cache it so it's only computed once.

Also rewrite as a dict comprehension. Timings for non-cached use:

200000 loops, best of 5: 1.87 usec per loop
->
200000 loops, best of 5: 1.53 usec per loop

@radarhere
Copy link
Member

I wonder if #7721 is a simpler and faster solution?

@hugovk
Copy link
Member Author

hugovk commented Jan 16, 2024

Yes, that's better, thanks!

@hugovk hugovk closed this Jan 16, 2024
@hugovk hugovk deleted the cache-ops-dict branch January 16, 2024 10:48
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.

Image.open: dictionary changed size during iteration (race condition)

2 participants