Skip to content

capture the calling scope once as callenv in [ - #7934

Merged
ben-schwen merged 1 commit into
bracket_modularizationfrom
brk/a3_callenv
Nov 3, 2026
Merged

ben-schwen merged 1 commit into
bracket_modularizationfrom
brk/a3_callenv

Conversation

@ben-schwen

Copy link
Copy Markdown
Member

Towards #852

Caches calling scope via parent.frame()

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (bracket_modularization@3e47560). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                    @@
##             bracket_modularization    #7934   +/-   ##
=========================================================
  Coverage                          ?   99.09%           
=========================================================
  Files                             ?       88           
  Lines                             ?    17440           
  Branches                          ?        0           
=========================================================
  Hits                              ?    17282           
  Misses                            ?      158           
  Partials                          ?        0           

☔ 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 Oct 24, 2026 •

Copy link
Copy Markdown
  • HEAD=brk/a3_callenv much faster for Date-IDate regression in #7213

(Plot image upload to picrd.com failed; download the artifact below to view plots)

Generated via commit 8ba52a7

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

Task Duration
R setup and installing dependencies 1 minutes and 55 seconds
Installing different package versions 26 seconds
Running and plotting the test cases 6 minutes and 4 seconds

Comment thread R/data.table.R Outdated
setalloccol(x, n, verbose=verbose) # always assigns to calling scope; i.e. this scope
if (is.name(name)) {
assign(as.character(name),x,parent.frame(),inherits=TRUE)
assign(as.character(name),x,callenv,inherits=TRUE)

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.

while we're here

Suggested change
assign(as.character(name),x,callenv,inherits=TRUE)
assign(as.character(name), x, callenv, inherits=TRUE)

Comment thread R/data.table.R
assign(as.character(name),x,callenv,inherits=TRUE)
} else if (.is_simple_extraction(name)) {
.reassign_extracted_table(name, x)
.reassign_extracted_table(name, x, callenv)

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.

nice! this one's tougher to spot

.reassign_extracted_table = function(name, value, env = parent.frame(2L)) {

@ben-schwen
ben-schwen force-pushed the brk/a3_callenv branch 2 times, most recently from 74c52e9 to c050ddb Compare November 1, 2026 21:02
@ben-schwen
ben-schwen removed this pull request from stack #7933 November 3, 2026 09:15
@ben-schwen
ben-schwen added this pull request to stack #7953 November 3, 2026 09:16
Base automatically changed from brk/a2_missing_flags to bracket_modularization November 3, 2026 09:18
@ben-schwen
ben-schwen force-pushed the brk/a3_callenv branch 2 times, most recently from 17a48e2 to 734378d Compare November 3, 2026 10:27
Capture parent.frame() once at the top as callenv and use that for every evaluation in the caller's scope (i, j, by, .SDcols, on, :=, ..var, the .N swap, SDenv's parent, ...).

No behaviour change.
@ben-schwen
ben-schwen merged commit 5c990f3 into bracket_modularization Nov 3, 2026
7 checks passed
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