-
Notifications
You must be signed in to change notification settings - Fork 78
Add num_children C level #2316
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
Add num_children C level #2316
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2316 +/- ##
==========================================
+ Coverage 93.28% 98.89% +5.61%
==========================================
Files 28 17 -11
Lines 26451 5994 -20457
Branches 1202 1188 -14
==========================================
- Hits 24675 5928 -18747
+ Misses 1744 36 -1708
+ Partials 32 30 -2
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
|
C level:
Python level: |
jeromekelleher
left a comment
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.
LGTM!
The num_roots stuff should be easy now, it's just tree.num_children[tree.virtual_root]
c/tskit/trees.c
Outdated
| parent[c] = TSK_NULL; | ||
| left_sib[c] = TSK_NULL; | ||
| right_sib[c] = TSK_NULL; | ||
| self->num_children[p]--; |
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.
We should follow the same pattern above and declare a local restrict pointer for num_children. This is to help the compiler optimise the code, avoiding some pointer chasing. (Probably doesn't make much difference in practice, but no point in not doing it here.)
Similarly below.
c/tests/test_trees.c
Outdated
| ret = tsk_tree_first(&t); | ||
| CU_ASSERT_EQUAL(t.num_children[2], 1); | ||
| CU_ASSERT_EQUAL(t.num_children[4], 2); | ||
| CU_ASSERT_EQUAL(t.num_children[5], tsk_tree_get_num_roots(&t)); |
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.
This will be a circular test once it's implemented - better to put the actual value in here. Likewise below.
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.
Yep. Will change that. Thanks for the comments. Will address them and the Lint error.
benjeffery
left a comment
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.
LGTM % JK comments
8e48174 to
688b875
Compare
|
Looks like this much is basically ready to merge. How should we stage the rest of the update @benjeffery? I guess we could hold this off until after 0.5.0 to try and get it shipped and then do the Python updates then? Or should we just push on with the changes now? |
|
The python side of this should be relatively straightforward right? I'm keen to get 0.5.0 out ASAP, but this is a really nice addition to the release. I think we include this and the edge-diffs then draw a hard line under the release. |
|
Okey dokey - would you mind creating the follow up issues we'd need after this for Python so? |
|
Cool. I should be able to finish the follow up by the end of the week. |
|
Yep, squash and rebase would be good. |
688b875 to
a504674
Compare
Done |
jeromekelleher
left a comment
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.
LGTM!
a504674 to
e8db04a
Compare
|
I've added a changelog. Will merge. |
e8db04a to
c9591eb
Compare
|
Looks like you missed updating |
|
I did indeed. Will fix it. Thank you valgrind. |
c9591eb to
1a5a6a2
Compare
|
@jeromekelleher Did you mean to merge this? Github says you removed the merge label. |
|
I was trying to get mergify to merge - I thought "turning it off and on again" might trigger things. |
|
@Mergifyio refresh |
✅ Pull request refreshed |
|
Circle CI is missing! Will try re triggering. |
|
@Mergifyio rebase |
✅ Branch has been successfully rebased |
1a5a6a2 to
33ccde2
Compare
First step towards adding num_children array for Trees. #2274