Skip to content

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

Merged
rich-iannone merged 1 commit intorstudio:masterfrom
olivroy:nanoplot-fast
Sep 25, 2024
Merged

Misc performance improvements for nanoplots / vec_*() functions.#1888
rich-iannone merged 1 commit intorstudio:masterfrom
olivroy:nanoplot-fast

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!

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