Re: [Rd] serialize() takes too long when serializing to a raw vector

From: Ashish Kulkarni <ashish.kulkarni_at_kalyptorisk.com>
Date: Thu 25 Jan 2007 - 13:26:22 GMT


Hin-Tak Leung wrote:
>
> It might be interesting to know get some details on your hardware.
>

It's a P4 2.66GHz with a standard Intel motherboard having 1GB RAM.

> On my box, linux native seems to be a little slower than
> your quick.serialize times:
>
> > system.time( serialize(matrix(0, 1000, 1000), NULL) )
> [1] 0.372 0.288 0.692 0.000 0.000
> > system.time( serialize(matrix(0, 2000, 2000), NULL) )
> [1] 1.237 1.195 2.501 0.000 0.000
>
> running R 2.4.1 windows under wine (same box) is a good deal s
> lower, but is not anywhere nearly as slow as yours.
>
> > system.time( serialize(matrix(0, 1000, 1000), NULL) )
> [1] 0.00 0.00 6.08 NA NA
> > system.time( serialize(matrix(0, 2000, 2000), NULL) )
> [1] 0.01 0.01 78.00 NA NA
> >
>

Well, the timings certainly differ quite a bit. What kind of hardware do you have? I suspect that most of the delay may be caused by memory reallocation since the size of the output raw array is not known up front. I would imagine that WINE would use the system memory allocator, not the one used by the windows kernel.

> Since you mentioned that you are using Rmpi, there is a possibility
> that you might be calling a different serialize() than base::serialize
> all together???

Nope, I hit this problem while using Rmpi and tracked it down to .mpi.serialize, which in turn calls base::serialize. From Rmpi:

.mpi.serialize <- function (obj)
{

    trans_obj = serialize(obj, NULL)
    if (getRversion() >= "2.4.0")

        return(trans_obj)
    else return(charToRaw(trans_obj))
}

Regards,
ashish



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Jan 26 00:26:48 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 16:31:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.