[R-SIG-Finance] Performance comparison xts v. zoo

Jeffrey Ryan jeffrey.ryan at lemnica.com
Wed Jan 26 00:07:14 CET 2011


Hi Ryan,

Sorry for the late reply.

The slides you are thinking about are from a talk I gave at Columbia
back in 2008, so they are a bit outdated.

http://www.quantmod.com/Columbia2008/ColumbiaDec4.pdf

In general, xts has gotten substantially faster since then.  Some
things in xts are now even faster than using raw matrices for data.

x <- .xts(1:1e6L, 1:1e6L)
system.time( x[,1] )
   user  system elapsed
  0.002   0.000   0.002

m <- coredata(x) # a matrix, no 'time' index, so not really a time series
system.time( m[,1] )
   user  system elapsed
  0.015   0.000   0.015

I haven't put together a comparison in a while, but repeating the
benchmarks in the slides have xts with a substantial edge, often times
an order of magnitude better (even 2 or 3 orders of magnitude)

Most of the differences in xts vs. zoo come from the C in xts of
course.  But as Gabor noted, the effort is under way to move many of
the core C functions back up into zoo.  The limits here are that while
xts and zoo are very, very compatible - some xts functionality differs
- and we can't realistically break anything in zoo in the process.
The other limit is with respect to time.  Some of the code is in zoo
already, though not 'switched on' yet. Subsetting and basic Ops are
really the primary target for the migration.

My 2c is that xts is as fast as it can be, as it is all highly
optimized C --- 10x faster than all the other ts classes at a minimum
--- but that zoo will be brought up to speed "soon". ;-)

The other part of xts is that it does make "development" speedier by
way of the ISO8601 subsetting and related to.period aggregation code.
Not sure if that counts for 'performance speed' as your original post
requests though.

Best,
Jeff

P.S. The timeSeries values in the slides are _much_ improved as of
current implementations - though still much slower than xts.

On Wed, Jan 19, 2011 at 7:08 AM, Sheftel, Ryan
<ryan.sheftel at credit-suisse.com> wrote:
>
> I am looking for a comparison of the performance speed between xts and
> zoo on time series. I remember once seeing this in a pdf document,
> perhaps a magazine article?, but after extensive google-ing I have come
> up blank.
>
> Any direction would be helpful before I reproduce the results myself.
> Thanks.
>
> ===============================================================================
> Please access the attached hyperlink for an important el...{{dropped:8}}
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com



More information about the R-SIG-Finance mailing list