Benchmark report
Source:
inst/benchmarks/crbcc_bench.Rmd
crbcc gives the same byte code as the GNU R compiler
package. It is faster, because it is written in C, not in R. It follows
the same structure as the original compiler so all credit goes to Luke
Tierney.
The install benchmark is slow, thus it runs only for a new crbcc release. The compile benchmark is fast, thus it runs in the CI for each commit. The two benchmarks ran on different machines, at different times, and possibly with different crbcc versions. Do not compare their times.
How the benchmarks run
Install benchmark
- Measures
-
R CMD INSTALLon the CRAN source tarball withMAKEFLAGS=-j8.timing-profile.Rgives the times elapsed (wall time), native (tools:::.shlib_internal) and bytecode (compiler:::tryCmpfun). - Packages
- 65: the 50 CRAN packages with the most downloads and the 15 recommended packages.
- Runs
- For each package, 3 runs with GNU R, then 3 runs with crbcc, one at a time.
- Value
- The median of the runs. A total is the sum of the package values.
- Machine
- Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz, 72 logical CPUs, Linux x86_64, in the image build.
- Software
-
R 4.6.2, crbcc 0.2.0, commit
121112b. - Date
- 2026-11-19 11:04 UTC.
Compile benchmark
- Measures
-
The warm time of one
cmpfun()call for each closure. The closures are the namespace functions, S4 methods and R6 methods of a package (crbcc:::package_closures). - Packages
- The 65 packages of the install benchmark.
- Runs
-
One R process for each package and compiler, with the R JIT off
(following what
R CMD INSTALLdoes). The process does one warm-up pass, then 3 timed passes. Each timed pass starts withgc()and uses a new random order. - Value
- The median of the passes for each closure. The speedup of a closure is its GNU R time divided by its crbcc time. The headline is the geometric mean of the closure speedups.
- Excluded
- Closures with a zero time (0) or with times of only one compiler (0).
- Machine
-
Intel(R) Xeon(R) 6973P-C, 4 logical CPUs, Linux x86_64, in the CI job
compile. - Software
-
R 4.6.2, crbcc 0.2.0, commit
47f5e60. - Date
- 2026-11-21 19:22 UTC.
Byte-code check
- Measures
-
One compile of each closure with each compiler, in the CI job
compile. A closure fails if the byte codes differ (crbcc:::identical_strict) or a compiler stops with an error. - Packages
-
77: the base packages without
datasetsandtcltk, and the packages of the install benchmark.
Install results
Total time of 65 packages
- Byte-code compile: 169.1 s with GNU R, 3.5 s with crbcc.
- Elapsed time: 17% less for the 50 CRAN packages, 49% less for the 15 recommended packages.
The 15 slowest packages
Elapsed time of R CMD INSTALL. The bar is the native time.
The label gives the change with crbcc.
Compile results
Speedup by closure size
A point is a closure. The size is the number of AST nodes
(crbcc:::function_size). The line gives the geometric means
of the size classes 1-9, 10-99, and so on.
- Total compile time: 59.57 s with GNU R, 0.73 s with crbcc. The ratio of the totals is 81.2x, with more weight for large closures.
Data
The crbcc_bench.py
docstring gives the columns of the raw data.
Install benchmark
- Times in s, the median of the runs. native is the GNU R time, because crbcc does not change the native code.
- reduction: the part of the GNU R elapsed time that crbcc saves.
65 packages
Compile benchmark
- size: the median closure size, in AST nodes.
- total: the median pass time, in ms. A pass time is the sum of its closure times.
- speedup: the geometric mean of the closure speedups.
65 packages