Skip to content

address slowdown in get_model_spec() #1072

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
Feb 26, 2024
Merged

Conversation

simonpcouch
Copy link
Contributor

This env_obj isn't used elsewhere in the function and accounts for a decent chunk of the overhead in this example.

With dev parsnip:

library(parsnip)

bench::mark(fit = fit(linear_reg(), mpg ~ ., 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 fit          1.51ms   1.78ms      547.    3.76MB     32.5

With this PR:

library(parsnip)

bench::mark(fit = fit(linear_reg(), mpg ~ ., 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 fit          1.41ms   1.51ms      642.    3.75MB     36.7

Created on 2024-02-26 with reprex v2.1.0

@simonpcouch simonpcouch merged commit 673b7d5 into main Feb 26, 2024
@simonpcouch simonpcouch deleted the slowdown-get_model_spec branch February 26, 2024 16:48
simonpcouch added a commit that referenced this pull request Feb 26, 2024
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 Mar 12, 2024
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.

1 participant