Created
August 18, 2020 10:58
-
-
Save djberg96/7b33f4eb04b5ba98aa71dd3851a8b825 to your computer and use it in GitHub Desktop.
This file contains hidden or 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' | |
| MAX = 10000000 | |
| Benchmark.bm(30) do |x| | |
| x.report("require") do | |
| MAX.times { require 'ffi' } | |
| end | |
| x.report("require unless") do | |
| MAX.times { require 'ffi' unless defined?(FFI) } | |
| end | |
| end | |
| # RESULTS | |
| user system total real | |
| require 9.909382 0.018558 9.927940 ( 9.943800) | |
| require unless 0.544861 0.000000 0.544861 ( 0.545700) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment