Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grepl often faster with perl = T #51

Open
KyleHaynes opened this issue Feb 28, 2020 · 5 comments
Open

grepl often faster with perl = T #51

KyleHaynes opened this issue Feb 28, 2020 · 5 comments

Comments

@KyleHaynes
Copy link

I notice this library has quite a few grepl calls. Not sure if you're aware but using perl is often considerably faster ...

example

> vec <- c(" ", "    ", "asdas", "dsdsd", letters, LETTERS)
> vec <- sample(vec, 10000000, replace = T)
> system.time(grepl("^\\s*$", vec))
   user  system elapsed 
   1.38    0.00    1.39 
> system.time(grepl("^\\s*$", vec, perl = T))
   user  system elapsed 
   0.72    0.03    0.75 
> system.time(grepl("^\\s*$", vec))
   user  system elapsed 
   1.32    0.00    1.33 
> system.time(grepl("^\\s*$", vec, perl = T))
   user  system elapsed 
   0.69    0.00    0.69 
@trinker
Copy link
Owner

trinker commented Feb 28, 2020

Hmmm. Very nice. Would you be willing to (1) test this on longer strings as well? And (2) make a pr with changes after checking the speed on each instance to make sure there is an improvement?

@KyleHaynes
Copy link
Author

  1. yep, 2) yep. Will get to this in the next few days

@trinker
Copy link
Owner

trinker commented Apr 16, 2020

@KyleHaynes checking to see if you had done any work with this

@KyleHaynes
Copy link
Author

@trinker extremely sorry, been completely flat chat with high priority work. I won't get to this for about a week.

@trinker
Copy link
Owner

trinker commented Apr 17, 2020

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

No branches or pull requests

2 participants