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

faster internal group_keys() #4642

Merged
merged 1 commit into from
Dec 4, 2019
Merged

faster internal group_keys() #4642

merged 1 commit into from
Dec 4, 2019

Conversation

romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Dec 4, 2019

library(bench)
library(dplyr)

callr::r(function(){
  library(dplyr)
  df <- tibble(x = rnorm(1e6), g = sample(rep(1:1e4, 100))) %>% group_by(g)
  bench::mark(a = group_keys(df))
}, lib = "/Users/romainfrancois/git/tidyverse/dplyr/bench-libs/0.8.3")
#> # 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 a             721µs    774µs     1217.     515KB     51.2

callr::r(function(){
  library(dplyr)
  df <- tibble(x = rnorm(1e6), g = sample(rep(1:1e4, 100))) %>% group_by(g)
  bench::mark(a = group_keys(df))
}, lib = "/Users/romainfrancois/git/tidyverse/dplyr/bench-libs/master")
#> # 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 a             1.3ms   1.44ms      663.    70.8KB     50.7

callr::r(function(){
  library(dplyr)
  df <- tibble(x = rnorm(1e6), g = sample(rep(1:1e4, 100))) %>% group_by(g)
  bench::mark(group_keys(df))
})
#> # 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 group_keys(df)   2.18µs   2.55µs   375549.    7.22KB     75.1

Created on 2019-12-04 by the reprex package (v0.3.0.9000)

@romainfrancois romainfrancois added this to the 0.9.0 milestone Dec 4, 2019
@romainfrancois romainfrancois merged commit 4304c13 into master Dec 4, 2019
@romainfrancois romainfrancois deleted the perf_group_keys branch December 4, 2019 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant