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

benchmark workflow -> base R #1249

Merged
merged 1 commit into from
Oct 26, 2024
Merged

benchmark workflow -> base R #1249

merged 1 commit into from
Oct 26, 2024

Conversation

vincentarelbundock
Copy link
Owner

No description provided.

Copy link

Benchmark results

💥 means that PR is more than 5% slower than main or CRAN
⚡ means that PR is more than 5% faster than main or CRAN

Click to see benchmark results
Expression PR time (median, seconds) % change with main % change with CRAN PR memory (MB) Mem. % change with main Mem. % change with CRAN
slopes(mod, vcov = FALSE, newdata = “mean”) 0.150 -2.6% -0.66% 208.412 0% 0%
slopes(mod, newdata = “mean”) 0.360 -1.1% -0.28% 212.616 0% 0%
slopes(mod, vcov = FALSE, variables = “X3”) 0.128 0% 0% 547.487 0% 0%
slopes(mod, variables = “X3”) 0.593 0.85% 0% 1086.331 0% 0%
slopes(mod, vcov = FALSE) 1.949 -1.47% 0.05% 11173.212 0% 0%
slopes(mod) 8.099 0.37% -0.22% 21786.187 0% 0%
hypotheses(mod, hypothesis = “b3 - b1 = 0”) 0.057 -3.39% -1.72%
4.454
0% 0%
hypotheses(mod, hypothesis = “b2^2 * exp(b1) = 0”) 0.057 -1.72% -1.72%
4.054
0% 0%
hypotheses(mod, hypothesis = ~reference) 0.089 -2.2% -1.11%
9.021
0% 0%
predictions(mod) 0.485 -3.96% -0.21% 1493.499 0% 0%
predictions(mod, newdata = “mean”) 0.130 -1.52% -2.26% 82.003 0% 0%
predictions(mod, newdata = datagrid(X2 = unique)) 4.276 1.06% -1.68% 1654.613 -0.05% -0.02%
comparisons(mod2) 0.649 0.62% 0.31% 1238.396 0% 0%
comparisons(mod2, comparison = “dydxavg”) 0.472 -1.67% -1.26% 993.770 0% 0%
comparisons(mod2, comparison = “eydxavg”) 1.303 -2.18% -1.96% 1650.491 0% 0%
comparisons(mod2, comparison = “ratioavg”) 0.481 -2.04% -2.04% 966.151 0% 0%

Generated via commit 26d114d

Download link for the artifact containing the test results: ↓ benchmark-results.zip

@vincentarelbundock
Copy link
Owner Author

@etiennebacher I just re-wrote the benchmark script in mostly base R. No action need. Just a FYI.

@vincentarelbundock vincentarelbundock merged commit 16daa0e into main Oct 26, 2024
13 checks passed
@etiennebacher
Copy link
Contributor

Thanks, I had tried with data.table but unnesting was surprisingly unfriendly compared to tidyverse.

@vincentarelbundock
Copy link
Owner Author

Yeah, I think the pattern in data.table is a bit unintuitive, but using by= and [[1]] seems to work:

library(data.table)
url <- "https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv"
dat <- na.omit(fread(url))

nested = dat[, list(data=list(.SD)), by=Region]

unnested = nested[, data[[1]], by = Region]

head(nested, 2)
>    Region                data
>    <char>              <list>
> 1:      E <data.table[17x23]>
> 2:      N <data.table[17x23]>

head(unnested, 2)
>    Region rownames  dept   Department Crime_pers Crime_prop Literacy Donations
>    <char>    <int> <int>       <char>      <int>      <int>    <int>     <int>
> 1:      E        1     1          Ain      28870      15890       37      5098
> 2:      E        4     4 Basses-Alpes      12935       7289       46      2733
>    Infants Suicides MainCity Wealth Commerce Clergy Crime_parents Infanticide
>      <int>    <int>   <char>  <int>    <int>  <int>         <int>       <int>
> 1:   33120    35039    2:Med     73       58     11            71          60
> 2:   23018    14238     1:Sm     76       49      5            70          12
>    Donation_clergy Lottery Desertion Instruction Prostitutes Distance  Area
>              <int>   <int>     <int>       <int>       <int>    <num> <int>
> 1:              69      41        55          46          13  218.372  5762
> 2:              37      80        32          29           2  351.399  6925
>    Pop1831
>      <num>
> 1:  346.03
> 2:  155.90

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.

2 participants