[Rcpp-devel] Rcpp "version" of R's match function

Romain Francois romain at r-enthusiasts.com
Thu Nov 15 15:24:06 CET 2012


Le 15/11/12 14:52, Hadley Wickham a écrit :
>> R
>> utilisateur     système      écoulé
>>        0.338       0.024       0.362
>> R (second time)
>> utilisateur     système      écoulé
>>        0.262       0.000       0.262
>> match_ manual Rcpp
>> utilisateur     système      écoulé
>>        0.144       0.000       0.144
>> match__ internal Rcpp
>> utilisateur     système      écoulé
>>        0.134       0.000       0.133
>
> Nice!
>
>> Worth noting that the R version gets better the second time. I guess R keeps
>> its hash table somewhere.
>
> Hmmm - see http://cran.r-project.org/web/packages/fastmatch/index.html

Ouch. Simon wins:

                   expr      min        lq    median        uq      max
1  fmatch(xx, letters)  59.4727  60.29989  74.18049  77.94288 112.2938
2 match__(xx, letters) 137.3878 137.77486 138.33766 152.14018 193.3748
3  match_(xx, letters) 147.7115 148.36442 149.20221 162.82343 171.3181
4   match(xx, letters) 288.4345 293.10380 294.58833 296.26125 333.1210

> Hadley
>
> PS.  Would you be interested in a set of R functions that from a quick
> skim of the R sources that I think could be much much faster if
> implemented in Rcpp?

Sure. Time I have available will decide what I do of the list ^^.

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com
`- http://bit.ly/SweN1Z : SuperStorm Sandy

blog:            http://romainfrancois.blog.free.fr
|- http://bit.ly/RE6sYH : OOP with Rcpp modules
`- http://bit.ly/Thw7IK : Rcpp modules more flexible



More information about the Rcpp-devel mailing list