Repository navigation
Initial sketch of read-only tables implementatation - #2057
jeromekelleher wants to merge 4 commits into
Conversation
|
I'm trying to wrap my head round this. So when tables get made from a tree sequence the tables are marked as read only by having a reference to the ts, makes sense. What about the other way around when |
For the first pass I think yes. The main thing we're trying to streamline here is: ts = tskit.load("bigfile.trees")
# analyse ts in lots of ways including using ts.tables.nodes.time and other column referencesThe creating-a-tree sequence-from-tables operation is much more niche I think. I guess we could mark the input TableCollection as read-only when we call |
|
Great, was thinking that would be the first workflow to optimise, and doing just that one first makes sense.
Pretty sure this would break a lot of things and is an unexpected side-effect to make the TC read-only, we'd likely need to make copy be the default and add an argument, or have a separate method? |
|
We should make sure this change fixes #2080 while we're in here doing this type of stuff. |
3fbc92f to
2a7ad57
Compare
|
Revisiting this in the light of #2441 and recent updates (and rebasing on them), and it looks like it basically works so we should probably try and push it through. I'll tip away at it as I have time. This is a significant breaking change so we'd need a major version number bump for it. |
2a7ad57 to
33f1af8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2057 +/- ##
==========================================
- Coverage 93.44% 91.88% -1.56%
==========================================
Files 28 28
Lines 27380 27071 -309
Branches 1253 1253
==========================================
- Hits 25584 24875 -709
- Misses 1762 2162 +400
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more.
|
fdfffca to
251f559
Compare
The "locked" attribute on table classes was unused, so we replace it with the new "state" variable that captures table states.
251f559 to
c41dca7
Compare
Initial proof of concept for making the TableCollection returned by
ts.tablesread-only. I've only done the plumbing for the NodeTable here, but the extension is pretty clear. The implementation is pretty confusing at the moment, I think it could be simplified quite a bit.I also had a look at what we could do in terms of returning direct read-only views of the column data. I think we could do this when the tables are in read-only model, so that
ts.tables.nodes.timeis an efficient operation. It doesn't look too bad, actually.While we're breaking stuff, we should also set all column arrays that we return to being read-only, even when they are copies returned when the tables aren't in read-only mode. This will hopefully let us support the (much more difficult) direct setting of table column memory from numpy arrays, at some point.
Any thoughts?