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

Misc performance improvements for nanoplots / vec_*() functions. #1888

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

olivroy
Copy link
Collaborator

@olivroy olivroy commented Sep 24, 2024

Summary

Improve a little performance for vec_*() by avoiding converting to a tibble and remove some dplyr calls to group_vars().

This could probably be improved further, but saw these quick fixes so I added that.

Checklist

I wonder if this could be improved further. I used the first example of cols_nanoplot()

illness |>
  dplyr::slice_head(n = 10) |>
  gt(rowname_col = "test") |>
  tab_header("Partial summary of daily tests performed on YF patient") |>
  tab_stubhead(label = md("**Test**")) |>
  cols_hide(columns = starts_with("norm")) |>
  fmt_units(columns = units) |>
  cols_nanoplot(
    columns = starts_with("day"),
    new_col_name = "nanoplots",
    new_col_label = md("*Progression*")
  ) |>
  cols_align(align = "center", columns = nanoplots) |>
  cols_merge(columns = c(test, units), pattern = "{1} ({2})") |>
  tab_footnote(
    footnote = "Measurements from Day 3 through to Day 8.",
    locations = cells_column_labels(columns = nanoplots)
  )

Before

image

This PR:
image

~8% gain! Not that bad I guess?

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

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

LGTM!

@rich-iannone rich-iannone merged commit 2e6cc6b into rstudio:master Sep 25, 2024
12 checks passed
@olivroy olivroy deleted the nanoplot-fast branch September 25, 2024 15:09
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