extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
174 stars 25 forks source link

fix(template): set `CARGO_BUILD_JOBS=2` on CRAN #312

Closed eitsupi closed 9 months ago

eitsupi commented 10 months ago

The CRAN policy limits the number of cores that can be used during installation to 2.

From https://cran.r-project.org/web/packages/policies.html

Checking the package should take as little CPU time as possible, as the CRAN check farm is a very limited resource and there are thousands of packages. Long-running tests and vignette code can be made optional for checking, but do ensure that the checks that are left do exercise all the features of the package.

If running a package uses multiple threads/cores it must never use more than two simultaneously: the check farm is a shared resource and will typically be running many checks simultaneously.

From https://cran.r-project.org/web/packages/using_rust.html

cargo build -j N defaults to the number of ‘logical CPUs’. This usually exceeds the maximum allowed in the CRAN policy, so needs to be set explicitly to N=1 or 2.

eitsupi commented 10 months ago

Note that hellorust switched from configuration by CARGO_BUILD_JOBS=2 to using the -j 2 option between 1.1.0 and 1.1.1. https://github.com/r-rust/hellorust/commit/a3ae6c24d062225e40607480386eaaaed6cddeb1

The reason is unknown.

I am not sure if using CARGO_BUILD_JOBS=2 here is a bad idea, as either setting should have the same effect.