4 ms·
I find that surprising. Do you have benchmarks?
by hadley 11y ago
I find that surprising. Do you have benchmarks?
- minimaxir 11y agoHuh. Turns out I'm wrong. I ran benchmarking on a 1.8M row dataset of SF crime data w/ 100 replications. Running grepl() via: benchmark(df %>% sample_frac() %>% filter(grepl("ARREST", Resolution))) completed in 257.58 seconds. Running str_detect() via: benchmark(df %>% sample_frac() %>% filter(str_detect(Resolution, "ARREST"))) completed in 248.917 seconds. Overall, str_detect() is faster by 3%. The stringr packages has more surprises than I thought!