Skip to content

Avoid eager splicing by using substitute() not enexpr()#7

Merged
DavisVaughan merged 1 commit intomainfrom
fix/avoid-eager-splice
Oct 9, 2025
Merged

Avoid eager splicing by using substitute() not enexpr()#7
DavisVaughan merged 1 commit intomainfrom
fix/avoid-eager-splice

Conversation

@DavisVaughan
Copy link
Copy Markdown
Owner

@DavisVaughan DavisVaughan commented Oct 9, 2025

Closes #6

Basically same solution as r-lib/bench#86

This works as expected now

cross::bench_versions(pkgs = c("rlang", "r-lib/rlang#1837"), {
  library(rlang)
  x <- as.list(1:1e6)
  bench::mark(list2(!!!x), iterations = 10)
})
#> # A tibble: 2 × 7
#>   pkg              expression       min   median `itr/sec` mem_alloc `gc/sec`
#>   <chr>            <bch:expr>  <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 rlang            list2(!!!x)    902ns   1.13µs   496738.        0B        0
#> 2 r-lib/rlang#1837 list2(!!!x)    615ns 738.07ns   880486.        0B        0

Created on 2025-10-09 with reprex v2.1.1

@DavisVaughan DavisVaughan force-pushed the fix/avoid-eager-splice branch from 503cf7f to 3bc62ae Compare October 9, 2025 17:26
@DavisVaughan DavisVaughan merged commit a825758 into main Oct 9, 2025
10 checks passed
@DavisVaughan DavisVaughan deleted the fix/avoid-eager-splice branch October 9, 2025 17:34
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

Successfully merging this pull request may close these issues.

Don't allow unquote splice in expr

1 participant