Closed m-muecke closed 4 months ago
Use safer (0 edge case) and slightly faster seq_along(x), seq_len(nrow(x)), seq_along(ncol(x))
seq_along(x)
seq_len(nrow(x))
seq_along(ncol(x))
x <- rnorm(100) bench::mark(1:length(x), seq_along(x)) #> # A tibble: 2 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 1:length(x) 0 41ns 9200446. 0B 0 #> 2 seq_along(x) 0 1ns 27803363. 0B 0
Created on 2024-07-12 with reprex v2.1.1
Use safer (0 edge case) and slightly faster
seq_along(x)
,seq_len(nrow(x))
,seq_along(ncol(x))
Created on 2024-07-12 with reprex v2.1.1