FW: [R] DLL Advice

Liaw, Andy andy_liaw at merck.com
Wed Feb 26 21:51:03 CET 2003


For those who are interested.  Anyone care to comment?  I have no idea the
performance gap on simple i/o can be that big...

Andy

From: Jason Fisher [mailto:stormplot at hotmail.com]
Sent: Wednesday, February 26, 2003 3:44 PM
To: andy_liaw at merck.com
Subject: RE: [R] DLL Advice


Hi Andy...

Comparing apples to apples really clarified things.

g77 -> 58 seconds to run
Visual FORTRAN -> 3.5 seconds to run

Wow!

I bet g77 and Visual FORTRAN handle read statements differently.  My program

is pretty simplistic.  Open a massive text file (323,063 KB) and read a few 
key pieces of information spread evenly throughout the file.

Thanks Again,
J



***************************************
Jason C. Fisher
UCLA Graduate Student
Civil & Environmental Engineering Dept.
5731 Boelter Hall
Box 951593
Los Angeles, CA 90095-1593
Phone Number: (310) 825-2292
Email: stormplot at hotmail.com
***************************************





>From: "Liaw, Andy" <andy_liaw at merck.com>
>To: "'Jason Fisher'" <stormplot at hotmail.com>
>Subject: RE: [R] DLL Advice
>Date: Wed, 26 Feb 2003 15:10:24 -0500
>
>You may want to try comparing apple to apple first.  Try compiling your 
>code
>to .exe using the MinGW g77 and see how that fares with the .exe you get
>with Visual Fortran.  I strongly suspect that what you're seeing is due in
>large part to the difference in g77 and visual fortran.
>
>g77 is known to be at best OK when it comes to performance.  The problem is
>that on Windows you don't have much of a choice.
>
>Andy
>
> > -----Original Message-----
> > From: Jason Fisher [mailto:stormplot at hotmail.com]
> > Sent: Wednesday, February 26, 2003 2:57 PM
> > To: r-help at stat.math.ethz.ch
> > Subject: [R] DLL Advice
> >
> >
> > Hi All...
> >
> > A few questions concerning the use of DLLs in R.  Before you
> > get scared off
> > and don't read any further (I've seen a lot of talk within
> > the help pages
> > concerning loading DLLs in R) realize that communication
> > between R and my
> > DLLs is solid.  The problem arises when comparing the computational
> > performance between calling a *.dll file, compiled using g77
> > under MinGW
> > version 2.0.0 with package upgrades, and calling an *.exe
> > file, compiled
> > with Compaq Visual FORTRAN Professional Edition 6.6.A.  Both
> > calls (.Fortran
> > and system) are made from the R - Tcl/Tk GUI environment.
> > After comparing
> > identical code, compiled as a DLL and EXE, I've come to the
> > disappointing
> > realization that the DLL calls take about five times the
> > computational time
> > of the EXE calls.  I tried the experiment using a number of different
> > FORTRAN codes with the same results.
> >
> > My first thought was that I was compiling the code incorrectly.  The
> > following command is what I typically use to generate the DLL.
> >
> > g77 -shared -o temp.dll temp.f
> >
> > After a short search over the net, I discovered a number of
> > g77 optimization
> > options (e.g. -O, -O2) for compiling.  These options had
> > little to no impact
> > on the computational times.  Next, I went back to "Writing R
> > Extensions" and
> > started working with the Rcmd SHLIB.  This again had little
> > to no impact on
> > computational time.
> >
> > Any ideas, I'm a novice at working with DLLs and know there must be
> > something I'm missing.  One option is to just call the EXE,
> > however, it just
> > seems crummy to generate an input file in R, run the EXE
> > which produces an
> > output file, read the EXE output file in R, and finally
> > delete the input
> > and output files.
> >
> > Thanks in advance for any insightful knowledge you bring my way.
> >
> > Regards,
> > Jason
> >
> > R 1.6.2
> >
> > ***************************************
> > Jason C. Fisher
> > UCLA Graduate Student
> > Civil & Environmental Engineering Dept.
> > 5731 Boelter Hall
> > Box 951593
> > Los Angeles, CA 90095-1593
> > Phone Number: (310) 825-2292
> > Email: stormplot at hotmail.com
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
>
>---------------------------------------------------------------------------
---
>Notice: This e-mail message, together with any attachments, contains 
>information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that

>may be confidential, proprietary copyrighted and/or legally privileged, and

>is intended solely for the use of the individual or entity named on this 
>message. If you are not the intended recipient, and have received this 
>message in error, please immediately return this by e-mail and then delete 
>it.
>
>===========================================================================
===
>


_________________________________________________________________




------------------------------------------------------------------------------




More information about the R-help mailing list