Back
Close

Computing with Data

elgeish
585.7K views

Running Compiled Code

Consider the code below, which compares two implementations of matrix multiplication: The first uses R's internal matrix multiplication and the second implements it through three nested loops, each containing a scalar multiplication. The first matrix multiplication is faster by several orders of magnitude even for a relatively small n. The key difference is that the built-in matrix multiplication runs compiled C++ code:

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io