This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
email = nil | |
Benchmark.ips do |x| | |
x.report('com if') { email.downcase.strip if email } | |
x.report('sem if') { email.to_s.downcase.strip } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calculating ------------------------------------- | |
com if 75866 i/100ms | |
sem if 56268 i/100ms | |
------------------------------------------------- | |
com if 7040009.2 (±18.0%) i/s - 33381040 in 5.003623s | |
sem if 1728021.7 (±20.0%) i/s - 8046324 in 5.000922s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment