Skip to content

Commit

Permalink
use setattr-> Fast always linear
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby Dylan Hocking committed Oct 3, 2024
1 parent 401f3d7 commit 7800a62
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .ci/atime/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ for(retGrp_setup in retGrp_values){
for(retGrp_expr in retGrp_values){
test.name <- sprintf("forderv(retGrp=%s-%s) improved in #4386", retGrp_setup, retGrp_expr)
extra.test.list[[test.name]] <- list(
setup = substitute({
setup = quote({
options(datatable.forder.auto.index = TRUE)
set.seed(1)
dt <- data.table(index = sample(N), values = sample(N))
data.table:::forderv(dt, "index", retGrp = RETGRP) # Initial sort to create the index and initialize caching
}, list(RETGRP=str2lang(retGrp_setup))),
index.list <- list()
for(retGrp in retGrp_values){
data.table:::forderv(dt, "index", retGrp = eval(str2lang(retGrp)))
index.list[[retGrp]] <- attr(dt, "index")
}
}),
expr = substitute({
data.table:::forderv(dt, "index", retGrp = RETGRP) # Reusing the index and computing group info.
}, list(RETGRP=str2lang(retGrp_expr))),
setattr(dt, "index", index.list[[retGrp_setup]])
data.table:::forderv(dt, "index", retGrp = retGrp_expr) # Reusing the index and computing group info.
}, list(
retGrp_setup=retGrp_setup,
retGrp_expr=str2lang(retGrp_expr)
)),
Slow = "b1b1832b0d2d4032b46477d9fe6efb15006664f4", # Parent of the first commit (https://github.com/Rdatatable/data.table/commit/b0efcf59442a7d086c6df17fa6a45c81b082322e) in the PR (https://github.com/Rdatatable/data.table/pull/4386/commits) where the performance was improved.
Fast = "ffe431fbc1fe2d52ed9499f78e7e16eae4d71a93") # Last commit of the PR (https://github.com/Rdatatable/data.table/pull/4386/commits) where the performance was improved.
}
Expand Down

0 comments on commit 7800a62

Please sign in to comment.