fix/258-getcommonChunk code in C++#342
Open
Nishita-shah1 wants to merge 5 commits into
Open
Conversation
Collaborator
|
thanks, but this seems overly complex (300+ lines of C++) |
Author
|
Okay, I'll do it
…On Mon, 29 Jun 2026, 20:45 Toby Dylan Hocking, ***@***.***> wrote:
*tdhock* left a comment (animint/animint2#342)
<#342 (comment)>
thanks, but this seems overly complex (300+ lines of C++)
is it possible to simplify? (I was expecting <100 lines of C++ code to
review, maybe I was being too optimistic though?)
—
Reply to this email directly, view it on GitHub
<#342?email_source=notifications&email_token=BCA4SQILXJKASH2I2JBP5FL5CKBX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBTGQYTANBZHA22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4834104985>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BCA4SQLDGN6B4VWARQFUMZD5CKBX7AVCNFSNUABEKJSXA33TNF2G64TZHMZDANZQHE3TQNZ3JFZXG5LFHM2DONRUGA2DOMJSGGQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BCA4SQOW353TAQA6MTQYNR35CKBX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBTGQYTANBZHA22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/BCA4SQMPCXWIOP74WOGKTPT5CKBX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOBTGQYTANBZHA22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #342 +/- ##
==========================================
+ Coverage 69.14% 73.10% +3.96%
==========================================
Files 163 165 +2
Lines 6002 8951 +2949
==========================================
+ Hits 4150 6544 +2394
- Misses 1852 2407 +555
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #258 by adding a small C++ fast path for common-column detection inside
getCommonChunk().New file:
src/get_common_chunk.cpp(~154 lines)Exported function:
common_value_for_group_subset_cpp(value_lists)For one
(column, group), given values split by chunk subset (e.g. eachshowSelectedlevel), it checks whether those values are identical across chunks. This mirrors R'scommon_value_for_group_subset()(matrix / NA / scalar logic from PR #242).Architecture: R still groups columns and groups via
detect_common_value_dt(). C++ only accelerates the inner compare. No change to TSV format, public API,geom-.r, oranimint.js.What this PR adds
src/get_common_chunk.cppsrc/RcppExports.cpp,R/RcppExports.RR/z_animintHelpers.Rcommon_value_for_group_subset()calls C++ when compiled; R fallback viaoptions(animint2.use.cpp)tests/testthat/test-compiler-getCommonChunk.Rvignettes/get-common-chunk-cpp.RmdDESCRIPTION,NAMESPACE,NEWS.md,.ci/atime/tests.RC++ design (review-friendly)
detect_common_value_dt()common_value_for_group_subset_cpp()getCommonChunk(),split_recursive(),saveChunks()Internal C++ helpers:
is_na_at,eq_at,scalar_at,wrap_common(correct R list shape forcommoncolumn).Documentation
Vignette:
vignettes/get-common-chunk-cpp.RmdAfter install:
vignette("get-common-chunk-cpp", package = "animint2")Motivation
After PRs #242 and #255,
getCommonChunk()is correct but the inner compare (matrix + NA handling) runs in R for every(column, group, chunk subset). This PR moves that hot inner loop to C++ while keeping grouping in R for a small, reviewable diff.Design highlights
Rf_Scalar*- Windows / R 4.5+ compatible C APIwrap_common()- returnslist(common = list(vector), is.common = ...)matching R shapedcast,split_recursive,saveChunksQuick test
Requires Rtools on Windows for first
load_all().