Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a fun one:
How come ~1/4 of the time in
induced_slot
is spent onSchemaView.__hash__
?In my tests generating the NWB schema, the
__hash__
method is called 1612428 times, that's a lot! by comparisoninduced_slot
is only called 3004 times in these tests.How come
__hash__
gets called so many times, or i guess a better question is why is it called at all? Turns out it's called every time a method wrapped withlru_cache
is called - sinceself
is an argument to a method, andlru_cache
uses the hashes of the arguments to match cached results, it has to hashSchemaView
every time, but the value is always the same (except whenmodified
is incremented).So this PR just stores the value of the hash and returns that, invalidating when
modified
is incremented. ezpz