-
Notifications
You must be signed in to change notification settings - Fork 166
Speed up caching #4383
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
base: master
Are you sure you want to change the base?
Speed up caching #4383
Conversation
de050ee
to
3951383
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, looks good to me.
def __eq__(self, other) -> bool: | ||
return type(other) is type(self) and hash(other) == hash(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be hash collisions, so we should just compare item by item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I was lazy and didn't want to write them all out for __hash__
and __eq__
.
This is a bit of a refactor of
parallel_cache
to try and address the performance issues reported in #3983.Fixes #3983
TODOs
The main changes are:
comm_getter
toget_comm
andcache_factory
tomake_cache
.as_hexdigest
every time we do a cache lookup. I think this was the main cause of the slowdown.type(make_cache()).__class__.__name__
which was unsafe and slow (?).Using the example from #3983 the performance improvement takes us (with a hot cache) from 31s to 14s, so I must be doing something right.