|
Slow regular-expression engine: msg#02390ruby-talk
This Awk code takes less than one hundredth of a second to run: BEGIN { regex = \ "o?o?o?o?o?o?o?o?o?o?o?o?o?o?" \ "o?o?o?o?o?o?o?o?o?o?o?o?o?" \ "ooooooooooooooooooooooooooooo" print "ooooooooooooooooooooooooooooo" ~ regex } This Ruby code takes 27.5 seconds: t = Time.now regex = Regexp.new( "o?o?o?o?o?o?o?o?o?o?o?o?o?o?" + "o?o?o?o?o?o?o?o?o?o?o?o?o?" + "ooooooooooooooooooooooooooooo" ) p "ooooooooooooooooooooooooooooo" =~ regex puts "#{ Time.now - t } seconds" See http://swtch.com/~rsc/regexp/regexp1.html
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |