Speed up on#48
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
==========================================
+ Coverage 91.72% 92.33% +0.60%
==========================================
Files 6 6
Lines 568 587 +19
==========================================
+ Hits 521 542 +21
+ Misses 47 45 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gipert
left a comment
There was a problem hiding this comment.
I think we could merge this, I don't think it would break anything.
But it's important to document these limitations in the docstring. Could you do that please?
|
I've updated the docstrings with limitations. I didn't add a note about the rglob one, since I don't think the definition here https://legend-exp.github.io/legend-data-format-specs/dev/metadata/#Specifying-metadata-validity-in-time-(and-system) implies an expectation that wildcards are allowed. If this PR is accepted, #46 can be closed |
|
Removing the deep copies worries me, I have a recollection of this being needed |
|
From memory without the deepcopy repeated calls to the database were not giving the expected results (not sure how well this is covered by our unit tests) |
|
Ok I found the commit : legend-exp/pylegendmeta@2e6e900 , and the reason was when calculating exposures we found the psd_statuses as they were nested were being changed by the dictionaries being mutable, here was our test case (old code now) |
|
yes let's try to reconstruct this problem, i also remember it now. we should try to cover it in the unit tests |
|
I agree it would be good to remove it but need a way to make sure that we are not going to run in mutable dictionary issues again |
|
Im also surprised hit pars is so much faster than channelmap despite it being a larger dictionary with a more complex structure? We should look into why |
|
Claude suggests we use a lightweight copy: |
|
Actually I like your solution more |
|
can we raise an exception if |
This is just because it's doing a shallow copy of the full dictionary without having to walk through any of it, while channelmap has to update a few things (note that the first read takes 3 s, much longer than channelmap). Otherwise, I added This change will break |
|
Hmm well the |
|
Ok attempt 2 at readonly: now I've added a I have also added more tests than my first attempt. Note that if not explicitly implmented, |
|
so are we sure now that this pr does not introduce any regression? (see snipped posted by george) |
|
As sure as we are in the completeness of the tests. For what it's worth, I reran the snippet from George and it worked correctly. I've also run a few tests with the querying functions which use this quite a bit under the hood and haven't seen any problems yet. |


Changes to TextDB and Props to speed up repeated calls to
on. After these changes, I was able to get it so that when callingonfor each cycle, the longest time is taken by yaml in reading the data.Note these break some features (that I'm not sure are important). If these features are important, then an alternative to avoid processing time associated with calling on frequently when no new data is being read is in this PR: #46
onis usingrglobto find paths; this replaces it with just checking if the path is valid. This means that wildcards will no longer work, and paths will not be found nested in other paths.