Skip to content

various object placement and constness improvements#7138

Merged
MichaelChirico merged 21 commits intomasterfrom
DataCodeIntegration
Jul 15, 2025
Merged

various object placement and constness improvements#7138
MichaelChirico merged 21 commits intomasterfrom
DataCodeIntegration

Conversation

@badasahog
Copy link
Contributor

@badasahog badasahog commented Jul 8, 2025

I was told previously to work on bigger PRs.

This one focuses primarily on object declarations, placements, and constness to further clarify intent earlier in the code.

After this I want to redo the naming scheme for some of the parsing functions and redo the parameters to return objects instead of using return pointers and structs.

I also want to arrange all the benchmarking data into a single struct for clarity. Often the timestamps are held in objects with unclear names.

@badasahog badasahog requested a review from aitap as a code owner July 8, 2025 10:41
@badasahog badasahog requested review from MichaelChirico and removed request for aitap July 8, 2025 10:41
@github-actions
Copy link

github-actions bot commented Jul 8, 2025

No obvious timing issues in HEAD=DataCodeIntegration
Comparison Plot

Generated via commit 398f117

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 2 minutes and 53 seconds
Installing different package versions 1 minutes and 19 seconds
Running and plotting the test cases 2 minutes and 33 seconds

@MichaelChirico
Copy link
Member

Please check the CI failure

@codecov
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.77%. Comparing base (a080833) to head (398f117).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7138   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files          81       81           
  Lines       15185    15197   +12     
=======================================
+ Hits        14999    15011   +12     
  Misses        186      186           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MichaelChirico
Copy link
Member

Basically looks good, could you please add some commentary for my edification & posterity?

@badasahog badasahog requested review from MichaelChirico and aitap July 9, 2025 07:44
@badasahog badasahog requested a review from MichaelChirico July 10, 2025 07:35
@badasahog badasahog requested a review from MichaelChirico July 13, 2025 07:09
@MichaelChirico
Copy link
Member

This change is still pending new tests as requested

@badasahog
Copy link
Contributor Author

Am I expected to write these tests? I'm not proficient in R.

@MichaelChirico
Copy link
Member

No time like the present to improve your proficiency.

@badasahog
Copy link
Contributor Author

I added @aitap 's test to the testing suite. It's giving a warning, I'm not sure why.

@MichaelChirico
Copy link
Member

Thank you!

@MichaelChirico MichaelChirico merged commit 5b74fac into master Jul 15, 2025
12 checks passed
@MichaelChirico MichaelChirico deleted the DataCodeIntegration branch July 15, 2025 16:38
Comment on lines 289 to +296
// \r is 13, \n is 10, and \0 is 0. The second part is optimized based on the
// fact that the characters in the ASCII range 0..13 are very rare, so a
// single check `ch<=13` is almost equivalent to checking whether `ch` is one
// of \r, \n, \0. We cast to unsigned first because `char` type is signed by
// default, and therefore characters in the range 0x80-0xFF are negative.
// We use eol() because that looks at eol_one_r inside it w.r.t. \r
// \0 (maybe more than one) before eof are part of field and do not end it; eol() returns false for \0 but the ch==eof will return true for the \0 at eof.
return *ch == sep || ((uint8_t)*ch <= 13 && (ch == eof || eol(&ch)));
return *ch == sep || (*ch <= 13 && (ch == eof || eol(&ch)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing this the first time, but the comment is now wrong. eol() is now called for $\mathtt{ch} \in [-128, 13]$ instead of $\mathtt{ch} \in [0, 13]$. At least it's harmless and probably won't show show up in profiling.

SEXP tt, ss = R_NilValue;
setAttrib(DT, R_NamesSymbol, tt = PROTECT(allocVector(STRSXP, ncol - ndrop))); nprotect++;
SEXP tt = PROTECT(allocVector(STRSXP, ncol - ndrop));
setAttrib(DT, R_NamesSymbol, tt); nprotect++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylistic: better keep the nprotect++ on the same line as the PROTECT() it's marking. setAttrib(), on the other hand, does not touch the protection stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants