-
Notifications
You must be signed in to change notification settings - Fork 24
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
memoize a bit less #131
Comments
I'm OK with solution #1 since the other methods and properties it relies on are still memoized. I wonder if that's just a band-aid solution -- it might make sense to make memoize use a fixed size cache with an eviction policy. |
timodonnell
added a commit
that referenced
this issue
Dec 14, 2015
Closes #131 Also a trivial performance improvement for object equality in Collection and Variant when the objects being compared are the same object.
This was referenced Dec 14, 2015
I made a PR with the simple fix for now, and a new ticket #133 to track the non-band-aid solutions |
timodonnell
added a commit
that referenced
this issue
Dec 18, 2015
Closes #131 Also a trivial performance improvement for object equality in Collection and Variant when the objects being compared are the same object.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a bunch of variants to annotate (calling
variant.effects().top_priority_effect().short_description
) and I noticed that each successive batch of 10,000 variants I annotate takes longer than the one before:When I kill it, it's always sitting in
Collection.__eq__
called by thememoize
wrapped function:It turns out the culprit is that we are memoizing
EffectCollection.top_priority_effect()
. Since this is a method, memoized withmemoize
(as opposed to a property memoized withmemoize_property
), the memoize cache is searching through a single giant and ever-growing dict ofEffectCollection
instances. SinceCollection
's hash implementation is collision-prone (it'slen
) we end up with lots of equality comparisons.Deleting this line: https://github.com/hammerlab/varcode/blob/master/varcode/effect_collection.py#L181 results in much better performance, that stays constant:
Possible things to do:
EffectCollection.top_priority_effect
memoize_property
memoize
implementation so the cached results don't grow unboundedlyThe text was updated successfully, but these errors were encountered: