Skip to content

speed up ensure_parsnip_format() #945

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

Merged
merged 1 commit into from
Apr 3, 2023
Merged

speed up ensure_parsnip_format() #945

merged 1 commit into from
Apr 3, 2023

Conversation

simonpcouch
Copy link
Contributor

A helper that gets a good bit of traffic at predict().

With main dev:

library(parsnip)

lm_fit <- fit(linear_reg(), mpg ~ ., mtcars)

bench::mark(old = predict(lm_fit, mtcars))
#> # A tibble: 1 × 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 old           619µs    654µs     1476.    1.08MB     35.9

With this PR:

bench::mark(new = predict(lm_fit, mtcars))
#> # A tibble: 1 × 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 new           389µs    404µs     2419.     599KB     40.3

Created on 2023-04-02 with reprex v2.0.2

@simonpcouch simonpcouch requested a review from hfrick April 3, 2023 12:40
Copy link
Member

@hfrick hfrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏇

@simonpcouch simonpcouch merged commit 6bb26b3 into main Apr 3, 2023
@simonpcouch simonpcouch deleted the ensure-speedup branch April 3, 2023 13:24
@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants