[Rd] Suggestion for serialization performance improvement on Windows

Henrik Bengtsson hb at stat.berkeley.edu
Wed Jul 14 07:53:18 CEST 2010


On Fri, Jul 9, 2010 at 6:49 AM, Bryan W. Lewis <bwaynelewis at gmail.com> wrote:
> Dear R developers,
>
>  The slow performance of serializing to a raw vector on Windows is an
> issue that has appeared in this list before.

My guess is that you are referring to:

[Rd] serialize() to via temporary file is heaps faster than doing it
directly (on Windows), 2008-07-24
http://tolstoy.newcastle.edu.au/R/e4/devel/08/07/2355.html

If so, that thread show how unnecessarily slow (5 mins instead of 5
secs) it is on Windows.

> It appears to be due to
> the frequent use of realloc from the resize_buffer method in
> serialize.c.
>
> I suggest a more granular, but still incremental, re-allocation of
> memory. For example change near the top of resize_buffer to:
>
> R_size_t newsize = needed + 65536 - (needed % 65536);
>
> or some other similar small multiple of a typical system page size.
>
> I have found this to dramatically improve performance of serialization
> to raw vectors on Windows.

I second this update, which seems to make serialize(...,
connection=NULL) useful in Windows.

Thxs,

Henrik

>
> Best,
>
> Bryan
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list