Skip to content

use yulab.utils::str_detect#3

Open
GuangchuangYu wants to merge 1 commit intorivasiker:masterfrom
GuangchuangYu:master
Open

use yulab.utils::str_detect#3
GuangchuangYu wants to merge 1 commit intorivasiker:masterfrom
GuangchuangYu:master

Conversation

@GuangchuangYu
Copy link

The stringr package has a huge dependency and as ggHoriPlot only use str_detect and not strongly depends on stringr, I would recommend using yulab.utils::str_detect() which even runs faster.

> fruit <- c("apple", "banana", "pear", "pineapple")
> bench::mark(
+     stringr = stringr::str_detect(fruit, "a"),
+     yulab.utils = yulab.utils::str_detect(fruit, "a")
+ )
# A tibble: 2 × 13
  expression      min median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time
  <bch:expr>  <bch:t> <bch:>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm>
1 stringr         9µs  9.8µs    93245.   723.3KB     28.0  9997     3    107.2ms
2 yulab.utils   3.5µs    4µs   218174.    5.58KB     43.6  9998     2     45.8ms
# ℹ 4 more variables: result <list>, memory <list>, time <list>, gc <list>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant