Last active
December 1, 2024 14:12
-
-
Save gauravs/c52e35b5d6a4cbe1bc65 to your computer and use it in GitHub Desktop.
#ruby #benchmark
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
iterations = 1_000_000 | |
Benchmark.bm do |bm| | |
# joining an array of strings | |
bm.report do | |
iterations.times do | |
["The", "current", "time", "is", Time.now].join(" ") | |
end | |
end | |
# using string interpolation | |
bm.report do | |
iterations.times do | |
"The current time is #{Time.now}" | |
end | |
end | |
end |
thadeubrito
commented
Sep 9, 2015
Vagrant: Virtual-Box provider on Windows
user system total real
4.930000 0.010000 4.940000 ( 4.953653)
3.730000 0.010000 3.740000 ( 3.751792)
Vagrant on EC2 m4.large
user system total real
3.310000 0.440000 3.750000 ( 3.754082)
2.170000 0.460000 2.630000 ( 2.625758)
Ubuntu 16.04 on Virtual Box:
user system total real
3.050000 0.380000 3.430000 ( 3.448118)
1.960000 0.370000 2.330000 ( 2.346749)
Hardware:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 78
Model name: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
Stepping: 3
CPU MHz: 2808.002
BogoMIPS: 5616.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 4096K
NUMA node0 CPU(s): 0,1
Macbook Pro, i7 32GB, VMWare Fusion
user system total real
2.650635 0.844401 3.495036 ( 3.495127)
2.028558 0.816248 2.844806 ( 2.844858)
Desktop, i7 32GB, VMWare Workstation
user system total real
2.417273 0.868471 3.285744 ( 3.294538)
1.786456 0.755417 2.541873 ( 2.543561)
M1 Studio
user system total real
1.645968 0.004830 1.650798 ( 1.651007)
1.285832 0.003811 1.289643 ( 1.289669)
@ozeias thats amazing!
user system total real 0.969262 0.008949 0.978211 ( 0.978292) 0.673414 0.001981 0.675395 ( 0.675425)
@ozeias finally broke the 1 second time!
@gauravs crazy to look back and see how much faster are the new devices.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment