[R-sig-hpc] serialize() slow

Fernando Saldanha fsaldan1 at gmail.com
Sat Aug 21 21:16:47 CEST 2010


In this post:

http://www.mail-archive.com/r-devel@r-project.org/msg13248.html

Henrik Bengtsson observes that the R function serialize() can run very
slowly when the argument connection is null and provides a function
serialize2() that runs much faster. The post is dated 7/24/2008.

Some code I wrote using package Rmpi was running slowly and I found
out the bottleneck was exactly the function serialize(), which is
called by some functions in Rmpi.

So I inserted the command

serialize <- serialize2

in my code and there was a dramatic acceleration of the relevant
portions of the program.

I have run the same code on two other computers and it did not run
slowly. To be more specific:

In all three computers I am running R 2.11.1.

All three computers are made by HP.

One dual core desktop PC (with no hyperthreading) running  Windows XP
32-bit and one Intel i5 notebook (dual core with hyperthreading)
running Windows 7 64-bit are not slowed down by serialize().

One dual core notebook (no hyperthreading) running Windows 7 64-bit
executes serialize() very slowly.

I used the function memory.limit() to increase memory allocation but
that did not make any difference.

Of course substituting serialize2 for serialize() is not an ideal
situation, among other reasons because serialize2() needlessly writes
to and reads from a connection (a temporary file).

Does anyone have insights on what is going on and maybe better ways to
deal with the issue?

Thanks.

Fernando Saldanha



More information about the R-sig-hpc mailing list