Created
April 10, 2015 11:21
-
-
Save JonathonMA/b4552a2ccb80949b47d3 to your computer and use it in GitHub Desktop.
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 'fruity' | |
def bench(desc) | |
puts desc | |
Fruity.compare do | |
time_now { Time.now; nil } | |
time_now_utc { Time.now.utc; nil } | |
end | |
end | |
bench "prefork" | |
Process.fork do | |
bench "child" | |
end | |
Process.wait | |
bench "parent" |
Docker image ruby:2.1.5-wheezy
prefork
Running each test 2048 times. Test will take about 1 second.
time_now is faster than time_now_utc by 2x ± 1.0
child
Running each test 2048 times. Test will take about 1 second.
time_now is faster than time_now_utc by 3x ± 0.1
parent
Running each test 2048 times. Test will take about 1 second.
time_now is faster than time_now_utc by 3x ± 0.1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OS X 10.10.2