Created
October 26, 2017 12:11
-
-
Save akshaymohite/246973a71d39c9fc606cd3f76d2114f5 to your computer and use it in GitHub Desktop.
faker-vs-raw-random-approach
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
2.4.0 :029 > Benchmark.ips do |benchmark| | |
2.4.0 :030 > benchmark.report('faker approach') { Faker::Number.number(6) } | |
2.4.0 :031?> benchmark.report('raw random approach') { rand(100000..999999).to_s } | |
2.4.0 :032?> end | |
Warming up -------------------------------------- | |
faker approach 28.347k i/100ms | |
raw random approach 159.529k i/100ms | |
Calculating ------------------------------------- | |
faker approach 315.433k (± 4.0%) i/s - 1.587M in 5.040671s | |
raw random approach 2.981M (± 7.0%) i/s - 14.836M in 5.002986s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment