Skip to content
Prev 59469 / 63433 Next

From .Fortran to .Call?

I had some time, so I updated a toy package I have for explaining R
and Fortran use to use both the .Call and the .Fortran interfaces [1].
I think the actual Fortran code is as close to identical as I can
reasonably make it. On my computer, the .Call interface (_f) is around
4 times as fast as the .Fortran interface (_f2).

Bill, I don't know if you can, or should, "just" change .Fortran to
.Call. You certainly cannot do the reverse. I think my source code
made as minimal a change as possible; maybe that would help.

-------
set.seed(77)
A <- runif(100, 0, 2000)
microbenchmark(LLC_f(A, 500, 500), LLC_f2(A, 500, 500), times =
10000L, control = list(order = 'block'), check = 'equal')
Unit: nanoseconds
                expr  min   lq      mean median   uq   max neval cld
  LLC_f(A, 500, 500)  700  702  799.5906    801  802  6601 10000  a
 LLC_f2(A, 500, 500) 3000 3101 3328.8712   3201 3401 19802 10000   b
--------

Thanks,

Avi

[1] https://github.com/aadler/SimpFort
On Sat, Dec 26, 2020 at 10:48 PM Avraham Adler <avraham.adler at gmail.com> wrote:
Message-ID: <CAL6gwnJ99yY_h-3Tib5xfG6wOONAastjQpU7N-PO=nC+D5dWsw@mail.gmail.com>
In-Reply-To: <CAL6gwn+=pJXMrUyJTx7utNUMXk+BSfyXnTVz2BnxeGyi9GveJw@mail.gmail.com>