[Rd] Suggestion for serialization performance improvement on Windows

Bryan W. Lewis bwaynelewis at gmail.com
Fri Jul 9 06:49:29 CEST 2010

Dear R developers,

  The slow performance of serializing to a raw vector on Windows is an
issue that has appeared in this list before. It appears to be due to
the frequent use of realloc from the resize_buffer method in

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.



More information about the R-devel mailing list