[Bioc-devel] C++ code performance issues
Peter Glaus
glaus at cs.man.ac.uk
Thu Mar 21 19:30:24 CET 2013
Hi,
I am working on BitSeq package, which has both command line C++ version
and Bioconductor version in which R calls the same C++ code with .C
function. While testing the development version of package on R 3.0.0 I
noticed that the "R version" runs much slower: 2-3 TIMES slower than the
pure C++ implementation.
Interestingly, the stable release of the "R version" seems to be as fast
as C++ version. (The underlying code has changed slightly but there
shouldn't be much difference)
Is there any reason for such behavior? Has anyone encountered similar
issue? Is there a way to make the C++ code called from R faster?
More details:
I compiled the C++ code with same g++ flags (... -O3 -pipe -fpic -g... )
and removed OpenMP support from both.
The functions take exactly the same input (input is read from a file),
and produce exactly same output (using same seed). A specific
computation that took the C++ version 12minutes, took the R(C++) version
47minutes. There is no IO during that part of the code and there was
just one R_CheckUserInterrupt() call during this time (I changed the
code, so that there would not be many of these calls.).
There are just few differences in the last stable release and that seems
to run even faster than current C++ (10m). (The stable release uses -O2
while compiling the c++ code.)
Thanks,
Peter.
More information about the Bioc-devel
mailing list