Construct, manipulate and display vectors of elapsed times in seconds. These
are numeric vectors, so you can compare them numerically, but they can also
be compared to human readable values such as '10ms'.
Arguments
- x
A numeric or character vector. Character representations can use
shorthand sizes (see examples).
Examples
as_bench_time("1ns")
#> [1] 1ns
as_bench_time("1")
#> [1] 1s
as_bench_time("1us")
#> [1] 1µs
as_bench_time("1ms")
#> [1] 1ms
as_bench_time("1s")
#> [1] 1s
as_bench_time("100ns") < "1ms"
#> [1] TRUE
sum(as_bench_time(c("1MB", "5MB", "500KB")))
#> [1] NA