1. In function, resize_buffer(...), replace
mb->buf = realloc(mb->buf, newsize);
with
mb->buf = Rm_realloc(mb->buf, newsize);
2. In function, free_mem_buffer(...), replace
free(buf);
with
Rm_free(buf);
Directions for compiling R in Windows are in http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-can-I-compile-R-from-source_003f
The following is a short result running on my Windows 7 desktop:
The original:
> system.time(serialize(matrix(0, 1000, 1000), NULL))
user system elapsed
5.74 4.39 10.15
> system.time(serialize(matrix(0, 2000, 2000), NULL))
user system elapsed
85.40 74.80 161.62
After updating:
> system.time(serialize(matrix(0, 1000, 1000), NULL))
user system elapsed
0.78 0.30 1.10
> system.time(serialize(matrix(0, 2000, 2000), NULL))
user system elapsed
6.21 4.13 10.54
No comments:
Post a Comment