[Rd] How allocate STRSXP outside of gc
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Apr 14 09:02:25 CEST 2005
On Wed, 13 Apr 2005, Vadim Ogranovich wrote:
> mkChar is a rather expensive call since it allocates a new R object. For
> example in reading char data from a file it is often advantageous to
> first try to look up an already made R string and only then use mkChar.
> That is, the overhead of the lookup is usually smaller than that of
> mkChar.
Yes (and that is one reason why scan in 2.1.0 uses lookups, space sharing
being the other), but both are really fast and this only comes into play
with hundreds of millions of items. (On my machine mkChar takes about 200
ns, hardly `rather expensive'.) And if you have that much data, why not
store it in a more efficient format?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list