Skip to content
Prev 43647 / 63424 Next

Understanding tracemem

But that should be

system.time(replicate(100, x[1e7 + 1L] <- 1L)) / 100
# ~0.10s
system.time(replicate(100, z$b <- 1L)) / 100
# ~ 0.04s

which suggests that it's not a deep copy.

But

x <- 1:1e6
z <- list(a = x)
system.time(replicate(100, z$b <- 1L)) / 100
# ~0.005s

which suggests it's not a shallow copy either.


But then neither of those are probably good tests because they modify
in place.  I'll think more.

Hadley