Closed hongyuanjia closed 1 year ago
{lubridate} is still much faster than date-time functions in {stringi}. No reason to change now.
m <- rep(1:12, each = 10)
d <- sample(1:20, 120, TRUE)
bench::mark(
lubridate = lubridate::make_date(2016L, month = m, day = d),
stringi = as.Date(stringi::stri_datetime_create(2016L, month = m, day = d, hour = 0L, locale = "C", tz = "UTC"))
)
#> # A tibble: 2 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 lubridate 4.7µs 5.1µs 171896. 7MB 51.6
#> 2 stringi 16.9µs 17.8µs 53111. 450KB 5.31
{stringi} has builtin date-time manipulation functions since 0.5-2 (2015-06-21). Consider to use {stringi} for all date-time manipulation.