Skip to content

Comment on Performance of ruby 1.9.1 string matching methods

Comments

                       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)
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.