Skip to content

Commit

Permalink
#4710 and #5520 follow up; combn() in R 3.1.0, move #if up to data.ta…
Browse files Browse the repository at this point in the history
…ble.h thanks Jan, plotting in dev memtest need not require imports of standard functions (strange)
  • Loading branch information
mattdowle committed Nov 15, 2022
1 parent 2d2892c commit e8a594c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions R/test.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
ans = timings[, diff:=c(NA,round(diff(RSS),1))][y+1L][,time:=NULL] # time is distracting and influenced by gc() calls; just focus on RAM usage here
catf("10 largest RAM increases (MB); see plot for cumulative effect (if any)\n")
print(ans, class=FALSE)
dev.new(width=14, height=7)
par(mfrow=c(1,2))
plot(timings$RSS, main=paste(basename(fn),"\nylim[0]=0 for context"), ylab="RSS (MB)", ylim=c(0,max(timings$RSS)))
mtext(lastRSS<-as.integer(ceiling(last(timings$RSS))), side=4, at=lastRSS, las=1, font=2)
plot(timings$RSS, main=paste(basename(fn),"\nylim=range for inspection"), ylab="RSS (MB)")
mtext(lastRSS, side=4, at=lastRSS, las=1, font=2)
get("dev.new")(width=14, height=7)

This comment has been minimized.

Copy link
@MichaelChirico

MichaelChirico Nov 15, 2022

Member

I guess get() is to avoid the new Suggests dependency on graphics/grDevices?

This comment has been minimized.

Copy link
@mattdowle

mattdowle Nov 15, 2022

Author Member

yes. i wrote that in the commit message. just something quick to get it to pass GLCI.

get("par")(mfrow=c(1,2))
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim[0]=0 for context"), ylab="RSS (MB)", ylim=c(0,max(timings$RSS)))
get("mtext")(lastRSS<-as.integer(ceiling(last(timings$RSS))), side=4, at=lastRSS, las=1, font=2)
get("plot")(timings$RSS, main=paste(basename(fn),"\nylim=range for inspection"), ylab="RSS (MB)")
get("mtext")(lastRSS, side=4, at=lastRSS, las=1, font=2)
}

catf("All %d tests (last %.8g) in %s completed ok in %s\n", ntest, env$prevtest, names(fn), timetaken(env$started.at))
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -4420,7 +4420,7 @@ test_no = 1223.0
oldnfail = nfail
for (nvars in seq_along(names(DT))) {
signs = expand.grid(replicate(nvars, c(-1L,1L), simplify=FALSE))
combn(names(DT), nvars, function(x) {
combn(names(DT), nvars, simplify=FALSE, function(x) { # simplify=FALSE needed for R 3.1.0
for (i in seq_len(nrow(signs))) {
test_no <<- signif(test_no+.001, 7)
ll = as.call(c(as.name("order"),
Expand Down
3 changes: 3 additions & 0 deletions src/data.table.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# define USE_RINTERNALS // #3301
# define DATAPTR_RO(x) ((const void *)DATAPTR(x))
#endif
#if !defined(R_VERSION) || R_VERSION < R_Version(3, 4, 0)
# define SET_GROWABLE_BIT(x) // #3292
#endif
#include <Rinternals.h>
#define SEXPPTR_RO(x) ((const SEXP *)DATAPTR_RO(x)) // to avoid overhead of looped STRING_ELT and VECTOR_ELT
#include <stdint.h> // for uint64_t rather than unsigned long long
Expand Down
2 changes: 0 additions & 2 deletions src/freadR.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,7 @@ void setFinalNrow(size_t nrow) {
for (int i=0; i<ncol; i++) {
SETLENGTH(VECTOR_ELT(DT,i), nrow);
SET_TRUELENGTH(VECTOR_ELT(DT,i), dtnrows);
#if defined(R_VERSION) && R_VERSION>=R_Version(3,4,0)
SET_GROWABLE_BIT(VECTOR_ELT(DT,i)); // #3292
#endif
}
}
R_FlushConsole(); // # 2481. Just a convenient place; nothing per se to do with setFinalNrow()
Expand Down

0 comments on commit e8a594c

Please sign in to comment.