TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
Performance of ruby 1.9.1 string matching methods
1 points
by
termie
over 15 years ago
1 comment
termie
over 15 years ago
<p><pre><code> user system total real str.casecmp(x): 0.150000 0.000000 0.150000 ( 0.147026) str.include?(x): 0.220000 0.000000 0.220000 ( 0.224157) str =~ /x/: 0.620000 0.000000 0.620000 ( 0.619257) str[x]: 0.480000 0.000000 0.480000 ( 0.476655) str.match(x): 1.240000 0.000000 1.240000 ( 1.244419) str.scan(x): 2.260000 0.000000 2.260000 ( 2.259026)</code></pre>