-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
originally from: tidyverse/dplyr#5742
library(dplyr, warn.conflicts = FALSE)
library(vctrs, warn.conflicts = FALSE)
suppressPackageStartupMessages(library(bit64))
df <- tibble(x = 1, x64 = integer64(1), xstr = "1", y = sample(10000, 1000000, replace = T)) %>% group_by(y)
first_i64 <- group_map(df, ~.x$x64[1])
first_int <- group_map(df, ~.x$x[1])
type_common <- function(x) vec_ptype_common(!!!x)
vec_c2 <- function(x) vec_c(!!!x)
bench::mark(
type_common(first_int),
vec_c2(first_int),
type_common(first_i64),
vec_c2(first_i64),
check = FALSE
)
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 4 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 type_common(first_int) 479.41µs 491.81µs 1878. 2.38KB 0
#> 2 vec_c2(first_int) 2.04ms 2.1ms 465. 195.45KB 0
#> 3 type_common(first_i64) 581.87ms 581.87ms 1.72 131.07KB 22.3
#> 4 vec_c2(first_i64) 2.04s 2.04s 0.489 764.05MB 12.2
Created on 2021-02-11 by the reprex package (v0.3.0)