From: Igor Maximchuk Date: 2003-11-07T06:31:30+09:00 Subject: Regexps Profiling Hello, I was recently using module 'profile' to profile code, that used Regexps. It was discovered, that Regexp or String class methods usage (Regexp#match, String:#=~) is being profiled only when there exists explicit call like r.match(s) or s =~ r, while s =~ /foo/ is not considered as a method call. And some testing shows, that s =~ /foo/ is a little faster than r.match(s) Questions: Are Regexp#match, String#scan, etc actually wrappings for something "internal" (=~)? How is this related to object-oriented regular expressions paradigm? example code: require 'profile' s = "abc" r = /(.)/ s =~ /(.)/ #r.match(s) #uncomment to see the difference #s =~ r #uncomment to see the difference