Performance of ruby 1.9.1 string matching methodspastie.org 1 pointtermie16 years ago1 commentSaveHideCopy link On HNComments−termieOP16y 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)
Comments