in reply to Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???
UPDATE Just realized you were comparing it with /foo/ and /bar/, which are still regex's. Well, it is possible that the regex engine can optimize a regex with a constant matching expression (like /foo/) to the point where it is much faster than alternation (/(foo|bar)/). To really be able to answer that question, you'd need to know a fair bit about the internals of the regex engine.
UPDATE 2 See Roy Johnson's reply below. His benchmark verifies my guess :)
|
|---|