From rpeng at jhsph.edu  Thu Jul 31 17:17:55 2008
From: rpeng at jhsph.edu (Roger D. Peng)
Date: Thu, 31 Jul 2008 11:17:55 -0400
Subject: [Rd] C versions of serialize/unserialize in packages
In-Reply-To: <59d7961d0807310753r6395a4c4p38f20a885d8c8581@mail.gmail.com>
References: <66f3bd910807310635k19c9379dve8f44998ebc164f7@mail.gmail.com>
	<59d7961d0807310753r6395a4c4p38f20a885d8c8581@mail.gmail.com>
Message-ID: <66f3bd910807310817k41c970d7u7b1f3c0959f5c7d6@mail.gmail.com>

Hmm...I don't think so.  The function I'm talking about loops over a
file many times and does a lot of 'seeks'.  I think just implementing
the loop in C makes it faster.  And besides, I see the speedup on
Linux, which doesn't have the problem you mention.

-roger

On Thu, Jul 31, 2008 at 10:53 AM, Henrik Bengtsson <hb at stat.berkeley.edu> wrote:
> Hi,
>
> On Thu, Jul 31, 2008 at 6:35 AM, Roger D. Peng <rpeng at jhsph.edu> wrote:
>> Are the functions 'R_Unserialize' and 'R_InitFileInPStream' allowed to
>> be used in R packages?  I guess I'm just not clear on the implications
>> of this comment in 'Rinternals.h':
>>
>> /* The connection interface is not yet available to packages.  To
>>   allow limited use of connection pointers this defines the opaque
>>   pointer type. */
>>
>> I have a function in the 'filehash' package that unserializes a bunch
>> of objects from a file and it seems to run much faster in C than in R.
>>  But I don't want to release something that uses a non-public
>> function/interface.
>
> You say "much faster".  Could this be related to what I recently observed:
>
> July 24, 2008 thread '[Rd] serialize() to via temporary file is heaps
> faster than doing it directly (on Windows)' [
> https://stat.ethz.ch/pipermail/r-devel/2008-July/050256.html ].
>
> My $0.02
>
> /Henrik
>
>
>>
>> Thanks,
>> -roger
>> --
>> Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/



[Rd] C versions of serialize/unserialize in packages
Roger D. Peng