Skip to content

Commit a673460

Browse files
MichaelChiricotdhockToby Dylan Hocking
authored
Add performance regression test for fread Date coercion (#6485)
* Refactor colClasses handling for readability * remove debug prints * C-level changes needed * update git hash again :\ * revert atime test, defer to follow-up * re-site NEWS * Add performance regression test for fread Date coercion * correct comment * for loop over fread args * tidy up * use atime_test_list(tests=extra.test.list) * undo addition of empty lines --------- Co-authored-by: Toby Dylan Hocking <[email protected]> Co-authored-by: Toby Dylan Hocking <[email protected]> Co-authored-by: Toby Dylan Hocking <[email protected]>
1 parent f4a3d92 commit a673460

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.ci/atime/tests.R

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# #6107 fixed performance across 3 ways to specify a column as Date, test each individually
2+
extra.args.6107 <- c(
3+
"colClasses=list(Date='date')",
4+
"colClasses='Date'",
5+
"select=list(Date='date')")
6+
extra.test.list <- list()
7+
for (extra.arg in extra.args.6107){
8+
this.test <- atime::atime_test(
9+
N = 10^seq(1, 7, by=0.25),
10+
setup = {
11+
set.seed(1)
12+
DT = data.table(date=.Date(sample(20000, N, replace=TRUE)))
13+
tmp_csv = tempfile()
14+
fwrite(DT, tmp_csv)
15+
},
16+
Slow = "e9087ce9860bac77c51467b19e92cf4b72ca78c7", # Parent of the merge commit (https://github.com/Rdatatable/data.table/commit/a77e8c22e44e904835d7b34b047df2eff069d1f2) of the PR (https://github.com/Rdatatable/data.table/pull/6107) that fixes the issue
17+
Fast = "a77e8c22e44e904835d7b34b047df2eff069d1f2") # Merge commit of the PR (https://github.com/Rdatatable/data.table/pull/6107) that fixes the issue
18+
this.test$expr = str2lang(sprintf("data.table::fread(tmp_csv, %s)", extra.arg))
19+
extra.test.list[[sprintf("fread(%s) improved in #6107", extra.arg)]] <- this.test
20+
}
21+
122
# A list of performance tests.
223
#
324
# See documentation in https://github.com/Rdatatable/data.table/wiki/Performance-testing for best practices.
@@ -176,6 +197,6 @@ test.list <- atime::atime_test_list(
176197
expr = data.table:::transform.data.table(dt, y = round(x)),
177198
Slow = "0895fa247afcf6b38044bd5f56c0d209691ddb31", # Parent of the first commit (https://github.com/Rdatatable/data.table/commit/93ce3ce1373bf733ebd2036e2883d2ffe377ab58) in the PR (https://github.com/Rdatatable/data.table/pull/5493/commits) that fixes the issue
178199
Fast = "2d1a0575f87cc50e90f64825c30d7a6cb6b05dd7"), # Merge commit of the PR (https://github.com/Rdatatable/data.table/pull/5493) that fixes the issue
179-
180-
NULL)
200+
201+
tests=extra.test.list)
181202
# nolint end: undesirable_operator_linter.

0 commit comments

Comments
 (0)