[R] R vs Python performance-wise

Martin Maechler maechler at stat.math.ethz.ch
Sat Dec 6 17:12:29 CET 2008


>>>>> "JQ" == Jose Quesada <quesada at gmail.com>
>>>>>     on Sat, 06 Dec 2008 12:28:34 +0100 writes:

    JQ> Hi, Has anyone run any R vs Python (numpy) tests?  I'd
    JQ> love to see what the differences performance-wise are,
    JQ> specially handling large sparse matrices.  Since both
    JQ> rely on external C code, there might not be much of a
    JQ> difference.

(yes).
You mention sparse matrices here,
but not the 'Matrix' package below.
For sparse matrices, I'd strongly recommend using that.

I note that you mention 'sna', and that uses sparseM
which also deals with sparse matrices, but less comprehensively
and partly based on suboptimal (mostly because less modern)
algorithms.

    JQ> If you know and use both languages, what are the main
    JQ> differences and what made you stick to one over another?

    JQ> I also noticed that there are strong libraries for
    JQ> social networks on both.


    JQ> python: networkX: https://networkx.lanl.gov/wiki pySNA:
    JQ> http://www.menslibera.com.tr/pysna/

    JQ> R: sna, network etc. see: http://www.jstatsoft.org/v24

yes.  IIRC, some or even most of these use graph representations without
explicit sparse matrix interfaces.
That's quite natural since sparse matrices can only represent
one number per (directed) relation.
On the other hand, I have been a bit startled to see that
(AFAICS) the 'network' package does not easily create sparse but
rather dense adjacency matrices...

One interesting package, not mentioned above (since it's rather
dealing with "traditional" graphs) is the 'igraph'
one.  AFAIK, it uses very efficient algorithms in some parts.

    JQ> Has anyone run a bechmark of the two systems doing the
    JQ> same operation?

    JQ> Which is the right environment for large social
    JQ> networks? Some packages have bindings for both
    JQ> languages, and of course, there's a reliable way to bind
    JQ> the two languages together, Rpy:
    JQ> http://rpy.sourceforge.net/

    JQ> So this may not be a big deal which one to pick.

    JQ> Thanks, -Jose

    JQ> -- Jose Quesada, PhD.  Max Planck Institute, Human
    JQ> Development, Berlin http://www.andrew.cmu.edu/~jquesada

    JQ> ______________________________________________
    JQ> R-help at r-project.org mailing list
    JQ> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
    JQ> read the posting guide
    JQ> http://www.R-project.org/posting-guide.html and provide
    JQ> commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list