Skip to content

Avoid using structure() in tests#7814

Merged
MichaelChirico merged 18 commits into
masterfrom
structure
Jul 14, 2026
Merged

Avoid using structure() in tests#7814
MichaelChirico merged 18 commits into
masterfrom
structure

Conversation

@MichaelChirico

Copy link
Copy Markdown
Member

Follow-up to #7813.

structure() is slow, and, as we saw there, can be a bit fragile. It's better to use the greenlit path to construct objects where possible.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.01%. Comparing base (f55ed35) to head (bb021b4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7814   +/-   ##
=======================================
  Coverage   99.01%   99.01%           
=======================================
  Files          88       88           
  Lines       17228    17234    +6     
=======================================
+ Hits        17059    17065    +6     
  Misses        169      169           

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
  • HEAD=structure faster P<0.001 for DT[by,verbose=TRUE] improved in #6296
    Comparison Plot

Generated via commit bb021b4

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

Task Duration
R setup and installing dependencies 3 minutes and 3 seconds
Installing different package versions 23 seconds
Running and plotting the test cases 5 minutes and 33 seconds

Comment thread inst/tests/optimize.Rraw Outdated
Comment thread inst/tests/tests.Rraw Outdated
Comment thread inst/tests/tests.Rraw Outdated

@ben-schwen ben-schwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall LGTM

When setting class() and subsequently setting attr() we could also set both with attributes()

@MichaelChirico

MichaelChirico commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

When setting class() and subsequently setting attr() we could also set both with attributes()

Not quite so simple, e.g. for building xt in other.Rraw, since attributes<- also wipes dim/dimnames/names. mostattributes<- might be appropriate, but the current approach looks ~OK.

@MichaelChirico MichaelChirico merged commit 9a20c15 into master Jul 14, 2026
14 checks passed
@MichaelChirico MichaelChirico deleted the structure branch July 14, 2026 17:26
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.

2 participants