Quamis
Quamis

Reputation: 11087

Is R a compiled language?

I can't find it anywhere on the web (and I don't want to install it). Is the R language a compiled language? How fast does it run a pre-written script? Does it do any kind of compilation, or just execute instructions line by line?

Upvotes: 8

Views: 1167

Answers (3)

Fhnuzoag
Fhnuzoag

Reputation: 3920

R is generally an interpreted language. However, package compiler offers bytecode compilation that can improve performance. You can also call compiled code from R.

In terms of how fast, it depends on what you are trying to do and how you are trying to do it. Some looping operations can be very slow. However, in many cases, with well written code, the performance of R scripting is determined by the speed of the underlying internal C-based libraries and system memory read-write speeds, and so R is about as fast as anything else.

Upvotes: 5

John D. Cook
John D. Cook

Reputation: 30099

I've often rewritten R code in C++ and made it run 100x faster. Looping is especially inefficient in R.

Upvotes: 6

Pridkett
Pridkett

Reputation: 5543

In most cases R is an interpreted language that runs in a read-evaluate-print loop. There are numerous extensions to R that are written in other languages like C and Fortran where speed or interfacing with native libraries is helpful.

Upvotes: 15

Related Questions