Skip to content
New issue

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

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

Already on GitHub? # to your account

Faster version of arg_match() #997

Closed
krlmlr opened this issue Jun 14, 2020 · 0 comments · Fixed by #998
Closed

Faster version of arg_match() #997

krlmlr opened this issue Jun 14, 2020 · 0 comments · Fixed by #998

Comments

@krlmlr
Copy link
Member

krlmlr commented Jun 14, 2020

because it's very slow. Example: more than half of the overhead in vctrs::vec_as_location2() comes from arg_match().

Downstream: tidyverse/tibble#780.

vctrs dev

library(vctrs)
library(magrittr)

bench::mark(
  vec_as_location2("x", 1L, "x", missing = "propagate", arg = "x"),
  iterations = 1000
) %>%
  dplyr::select(-expression)
#> # A tibble: 1 x 5
#>        min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1   78.7µs   88.8µs     9451.     322KB     18.9

Created on 2020-06-14 by the reprex package (v0.3.0)

r-lib/vctrs#1145

library(vctrs)
library(magrittr)

bench::mark(
  vec_as_location2("x", 1L, "x", missing = "propagate", arg = "x"),
  iterations = 1000
) %>%
  dplyr::select(-expression)
#> # A tibble: 1 x 5
#>        min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1   25.7µs   34.9µs    26573.     172KB     26.6

Created on 2020-06-14 by the reprex package (v0.3.0)

@krlmlr krlmlr changed the title Rewrite arg_match() in C Faster version of arg_match() Jun 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant