HenrikBengtsson / profmem

🔧 R package: profmem - Simple Memory Profiling for R
https://cran.r-project.org/package=profmem
35 stars 2 forks source link

VIGNETTE: Was R updated such that example is no longer valid? #7

Closed HenrikBengtsson closed 6 years ago

HenrikBengtsson commented 6 years ago

Vignette example may no longer be true in recent R versions, e.g. in R 3.4.3 there seems to be no coercion to double for x in:

> p <- profmem({
+     small <- (x < 5000)
+ })
> p
Rprofmem memory profiling of:
{
    small <- (x < 5000)
}
Memory allocations:
       bytes      calls
1      80040 <internal>
2      40040 <internal>
total 120080           
HenrikBengtsson commented 6 years ago

The change/improvement seems to have occurred going from R 3.3.3 to R 3.4.0:

> getRversion()
[1] '3.3.3'
> x <- integer(1000)
> y <- double(1000)
> profmem::profmem(z <- (x < y))
Rprofmem memory profiling of:
z <- (x < y)

Memory allocations:
      bytes      calls
1      8040 <internal>
2      4040 <internal>
total 12080      

and

> getRversion()
[1] '3.4.0'
> x <- integer(1000)
> y <- double(1000)
> profmem::profmem(z <- (x < y))
Rprofmem memory profiling of:
z <- (x < y)

Memory allocations:
      bytes      calls
1      4040 <internal>
total  4040           

The same is true for z <- (x == y).

HenrikBengtsson commented 6 years ago

I've just asked about this on R-devel: https://stat.ethz.ch/pipermail/r-devel/2018-January/075449.html

HenrikBengtsson commented 6 years ago

@lawremi (thxs) confirmed (he made) this improvement for R 3.4.0. So, the vignette/README needs a new example.