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

Fast path for vec_assign(x, integer())? #1408

Closed
mgirlich opened this issue Jun 25, 2021 · 1 comment · May be fixed by #1590
Closed

Fast path for vec_assign(x, integer())? #1408

mgirlich opened this issue Jun 25, 2021 · 1 comment · May be fixed by #1590

Comments

@mgirlich
Copy link
Contributor

Similarly to #1400 I think it would make sense to have a fast path for vec_assign(x, integer())

The motivation is also similar: e.g. when using vec_assign() in a coalesce() like fashion vec_assign(x, is.na(x), 1L).

Benchmark

library(rlang)
library(vctrs)

x <- 0L + 1:10e6

bench::mark(
  vec_assign = {vec_assign(x, integer(), integer())},
  check = FALSE
)
#> # A tibble: 1 x 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 vec_assign    5.1ms   5.53ms      165.    38.2MB     172.

Created on 2021-06-25 by the reprex package (v2.0.0)

@lionel-
Copy link
Member

lionel- commented Sep 20, 2022

Thanks for looking into this but we've decided early exits like this are not worth the complications.

@lionel- lionel- closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
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 a pull request may close this issue.

2 participants