soveran/scrivener — pull request #7 by frodsan (2014-01-07 05:11:54+00:00)
Title: Use #=== operator instead of #match to compare a regexp against a string...

....

It seems that performs better too. I ran this benchmark:

```ruby
require "benchmark/ips"
require "scrivener/validations"

EMAIL = Scrivener::Validations::EMAIL

Benchmark.ips do |x|
x.report("match") { "frodsan@me.com".match(EMAIL) }
x.report("===") { EMAIL === "frodsan@me.com" }
end
```

Results:

```
Calculating -------------------------------------
match 21712 i/100ms
=== 29928 i/100ms
-------------------------------------------------
match 328645.0 (±6.7%) i/s - 1650112 in 5.046365s
=== 534819.5 (±8.7%) i/s - 2663592 in 5.034419s
```

There results are the following: