Open mgirlich opened 1 year ago
Functions like tags$tr() can easily be a little faster.
tags$tr()
library(htmltools) set.seed(1) n <- 50e3 data <- vroom::gen_character(n) f <- function(data) { for (i in seq_along(data)) { tags$tr(data[[i]]) } } bench::mark(f(data)) # before # # A tibble: 1 × 13 # expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc total_time # <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> <dbl> <bch:tm> # 1 f(data) 1.37s 1.37s 0.730 41.2KB 27.8 1 38 1.37s # after # # A tibble: 1 × 13 # expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc total_time # <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> <dbl> <bch:tm> # 1 f(data) 830ms 830ms 1.20 30.1KB 30.1 1 25 830ms
Functions like
tags$tr()
can easily be a little faster.