Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should profiles for skeleton package and sourcing functions match? #163

Open
Thell opened this issue Dec 23, 2021 · 1 comment
Open

Should profiles for skeleton package and sourcing functions match? #163

Thell opened this issue Dec 23, 2021 · 1 comment

Comments

@Thell
Copy link

Thell commented Dec 23, 2021

I asked that in discord and was asked to make an issue for discussion.

On the skeleton package, as @Ilia-Kosenkov , rightly pointed out (in Discord) the release profile is an obvious choice for the creation of production ready packages. On the 'sourcing' side it didn't seem clear cut as to why it doesn't default to release like the skeleton does and some comments regarding thoughts on this start here on discord.

It has also been posted on in Benchmark Against Rcpp #11.

Again, as a newcomer, I expect it to be release build unless otherwise directed via an argument or overridden by a ~/.R/Makevars setting (or something similar).

@Ilia-Kosenkov
Copy link
Member

I tried to benchmark simple rextendr function compilation, and the results are somewhat inconclusive. I see no significant difference between release and dev, but there is a noticeable increase in memory gced by R when compiling for release.
Executed on Windows using i7-11700K and SATA SSD.

rust_fn <- "fn rust_add(x : Doubles, y : Doubles) -> Doubles {x.iter().zip(y.iter()).map(|(xx, yy)| xx + yy).collect()}"

release <- function() rextendr::rust_function(rust_fn, profile = "release", extendr_deps = list(`extendr-api` = list(git = "https://github.com/extendr/extendr")), cache_build = FALSE, quiet = TRUE)
develop <- function() rextendr::rust_function(rust_fn, profile = "dev", extendr_deps = list(`extendr-api` = list(git = "https://github.com/extendr/extendr")), cache_build = FALSE, quiet = TRUE)

tictoc::tic()
bench::mark(release(), develop(), check = FALSE, iterations = 10L) |> print()
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 2 x 13
#>   expression      min median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time
#>   <bch:expr> <bch:tm> <bch:>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm>
#> 1 release()     12.6s    13s    0.0767    18.4MB   0.0844    10    11      2.17m
#> 2 develop()       13s  13.2s    0.0757   416.7KB   0.0833    10    11       2.2m
#> # ... with 4 more variables: result <list>, memory <list>, time <list>,
#> #   gc <list>
tictoc::toc()
#> 290.25 sec elapsed

Created on 2021-12-27 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants