Actions
Patch #28939
closedreplace regexp with casecmp
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Description
require 'benchmark/ips' Benchmark.ips do |x| x.report('casecmp') { 'PostgreSql'.casecmp('postgresql') == 0 } x.report('match') { 'PostgreSql' =~ /postgresql/i } x.report('match?') { 'PostgreSql'.match? /postgresql/i } x.compare! end
Comparsion: casecmp: 4218477.8 i/s match?: 3025829.3 i/s - 1.39x slower match: 2222223.1 i/s - 1.90x slower
Files
Related issues
Actions