Skip to content

Instantly share code, notes, and snippets.

@Tensibai
Tensibai / Benchmark SO
Created December 31, 2015 09:12
The code used for benchmarking
library(stringr)
library(microbenchmark)
str<-c("3412123401234")
replength<-function(pat,s) {
length( gregexpr(pat,s)[[1]] )
}
repeats<-function(s) {
r<-sapply(