4 ms·
I have used R a few times now, and I definitely agree with the statement that thinking in vectors is central to writing good R scripts. However, as a computer e
by dwrodri 5y ago
I have used R a few times now, and I definitely agree with the statement that thinking in vectors is central to writing good R scripts. However, as a computer engineer and performance junkie, its unfortunate that it doesn't get as much attention as other "STEM DSLs" (Julia, MATLAB) when it comes to performance.
The same could technically be argued for Python; The current approaches to dealing with high-performance compute workloads either rely on JITing (e.g. Numba, Tensorflow/JAX's XLA) or bridging over to giant binary blobs through the CPython's well-supported C interop.
- teleforce 5y agoThere are few comments here complaining about R performance just like the parent comment. It's a shame that R does not have industrial strength industrial compiler based on this blog article unlike Python [1]. If you want to see the performance benchmark of R against major programming languages for data analysis please check this excellent keynote speech on the R compilation or more accurately on failures of R compilation effort [2]. As mentioned in [1], the main reason people do not focus on providing industrial strength compiler for R is probably because most of R program’s time are spent in the library codes that are written in a compiled language (e.g., C or Fortran). As you can see from [2], even though this is the case (computation intensive being delegated to proper compiled languages), the R programs running time still suffers due to the "impedance mismatch" because of the look up overheads, indirections, etc. Perhaps someone should try to compile, transpile and/or embed R inside D language similar to the efforts provided in [3][4]. D now supports C compiler internally, has DasBetterC and D interface to C++ (DPP) is second to none. Additionally, since D can also perform better than Fortran codes for numerical computing perhaps Fortran codes can eventually be replaced by existing high performance D library like Mir[5]. I can foresee this symbiotic relationship can be beneficial for R and D (R on D?). D can becomes very popular with extra humongous data analysis and statistics libraries from CRAN, and R can get the run time and compilation performance improvement it badly needs. [1]https://www.r-bloggers.com/2021/05/where-are-the-industrial-strength-r-compilers/ https://www.r-bloggers.com/2021/05/where-are-the-industrial-... [2]https://www.youtube.com/watch?v=VdD0nHbcyk4 https://www.youtube.com/watch?v=VdD0nHbcyk4 [3]https://dlang.org/blog/2018/06/20/how-an-engineering-company-chose-to-migrate-to-d/ https://dlang.org/blog/2018/06/20/how-an-engineering-company... [4]https://theartofmachinery.com/2021/01/01/djinn.html https://theartofmachinery.com/2021/01/01/djinn.html [5]http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/glas-gemm-benchmark.html http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/...