TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Performance of ruby 1.9.1 string matching methods

1 pointsby termieover 15 years ago

1 comment

termieover 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>