We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
vec_match()
Slower than match() by 50%?
match()
n <- 1E6 m <- 1E3 vs <- seq(n) index <- seq(m) value <- list(rev = as.list(rev(index)), nchar = as.list(nchar(index))) bench::mark( "Rmatch" = { value_nw2 <- lapply(value, function(x) { unname(x[match(seq_along(vs), index)]) }) }, "vec_match" = { value_nw2 <- lapply(value, function(x) { unname(x[vctrs::vec_match(seq_along(vs), index)]) }) } ) #> # A tibble: 2 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 Rmatch 13.6ms 14.1ms 69.7 34.6MB 279. #> 2 vec_match 27.3ms 28.1ms 34.1 38.2MB 102.
Created on 2024-04-09 with reprex v2.1.0
Downstream: igraph/rigraph#1327 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Slower than
match()
by 50%?Created on 2024-04-09 with reprex v2.1.0
Downstream: igraph/rigraph#1327 (comment)
The text was updated successfully, but these errors were encountered: