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

Fix data frame initialisation in bind_rows() #5502

Merged
merged 3 commits into from
Apr 19, 2021

Conversation

lionel-
Copy link
Member

@lionel- lionel- commented Aug 28, 2020

Closes #5417.

@lionel- lionel- requested a review from hadley August 28, 2020 15:00
@lionel-
Copy link
Member Author

lionel- commented Aug 28, 2020

Performance impact:

new_list <- purrr::map(1:10000, function(x) list(A = 2 * x, B = 4 * x)
bench::mark(bind_rows(new_list))[1:8]

#> # Master
#>   expression               min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc
#>   <bch:expr>          <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>
#> 1 bind_rows(new_list)    181ms    194ms      5.25     821KB     14.0     3     8

#> # This PR
#>   expression               min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc
#>   <bch:expr>          <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>
#> 1 bind_rows(new_list)    552ms    552ms      1.81     821KB     9.05     1     5

@hadley
Copy link
Member

hadley commented Apr 19, 2021

And #5749

@lionel- lionel- merged commit 1526aca into tidyverse:master Apr 19, 2021
@lionel- lionel- deleted the fix-bind-rows branch April 19, 2021 15:57
lionel- added a commit that referenced this pull request Apr 20, 2021
@lionel-
Copy link
Member Author

lionel- commented Apr 20, 2021

@DavisVaughan Good point about name-repair. We don't need to repair names before calling vec_rbind() since vec_rbind() repairs them. Fixed in 827615c.

The perf example above was reduced from 370ms to 240ms. Thanks!

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 this pull request may close these issues.

bind_rows() does not check list contents
4 participants