Skip to content

removed redundant object declarations#7181

Merged
MichaelChirico merged 3 commits intomasterfrom
redundantCodeRemoval
Jul 22, 2025
Merged

removed redundant object declarations#7181
MichaelChirico merged 3 commits intomasterfrom
redundantCodeRemoval

Conversation

@badasahog
Copy link
Contributor

Followup to #7138

I wanted to separate this into a different pr because I have a feeling this code was here intentionally (although I can't tell why).

I'm 100% sure it doesn't do anything.

This pr also has a failing test, but I've verified that that test also fails on the current master.

@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.77%. Comparing base (c8bbb58) to head (5476c96).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7181      +/-   ##
==========================================
- Coverage   98.77%   98.77%   -0.01%     
==========================================
  Files          81       81              
  Lines       15223    15212      -11     
==========================================
- Hits        15037    15026      -11     
  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.

@aitap
Copy link
Member

aitap commented Jul 16, 2025 via email

@github-actions
Copy link

github-actions bot commented Jul 16, 2025

  • HEAD=redundantCodeRemoval slower P<0.001 for setDT improved in #5427
    Comparison Plot

Generated via commit 5476c96

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

Task Duration
R setup and installing dependencies 2 minutes and 46 seconds
Installing different package versions 40 seconds
Running and plotting the test cases 2 minutes and 37 seconds

@badasahog
Copy link
Contributor Author

badasahog commented Jul 16, 2025

That's not the test I was referring to.

Running test id 2334         Test 2334 ran without errors but failed check that x equals y:
> x = fread(f)
             V1  [Key= Types=dou Classes=num]
    1: 1.999985
    2: 1.999985
   ---
19999: 1.999985
20000: 1.999985
> y = TRUE
First 1 of 1 (type 'logical'):
[1] TRUE

@aitap
Copy link
Member

aitap commented Jul 16, 2025 via email

@badasahog
Copy link
Contributor Author

I'm on Windows. Really I'm not sure how to address this because I'm not familiar with the production process.

If it's not in my branch then is this pr ready to go?

@MichaelChirico
Copy link
Member

Here are the logs of the error:

https://gitlab.com/Rdatatable/data.table/-/jobs/10696837289

I think we should fix the bug (presumably introduced by #7138) before continuing to dig a hole with further edits to the file.

@MichaelChirico
Copy link
Member

BTW, from the history, I guess these local variables were chosen as a way to minimize the diff in this rather large PR: 05edd24

Since before, all those variables were declared in the signature, assigning them locally by reading ctx avoided needing to make all the edits you've done in the same PR & ballooning the reviewer burden.

@jangorecki
Copy link
Member

Since before, all those variables were declared in the signature, assigning them locally by reading ctx avoided needing to make all the edits you've done in the same PR & ballooning the reviewer burden.

Many edits suffers readability of the code.
What this change is trying solve?

@badasahog
Copy link
Contributor Author

Many edits suffers readability of the code.
What this change is trying solve?

huh?

@jangorecki
Copy link
Member

This change makes code less readable, not sure what are the benefits here

@jangorecki
Copy link
Member

jangorecki commented Jul 17, 2025

Seems like object declaration was useful to make code easier to read, so not really redundant.

But as I don't do any fread C coding I leave it up to other devs who maintain that part.

@badasahog
Copy link
Contributor Author

I think it makes it better, as its clear where the data is coming from. This has all the downsides of an abstraction while also making the function longer.

@MichaelChirico
Copy link
Member

I am OK w the change, my only question is, is there no benefit to the const annotation to signal that these objects are read-only within the scope & therefore ctx won't be written from this routine?

@badasahog
Copy link
Contributor Author

The compiler can figure that out

@MichaelChirico MichaelChirico merged commit e0d40b1 into master Jul 22, 2025
12 checks passed
@MichaelChirico MichaelChirico deleted the redundantCodeRemoval branch July 22, 2025 19:58
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.

4 participants