Skip to content

Instantly share code, notes, and snippets.

@lokeshh
Created August 15, 2016 18:04
Show Gist options
  • Save lokeshh/13ae3d100d6294c0c2d216c62170915f to your computer and use it in GitHub Desktop.
Save lokeshh/13ae3d100d6294c0c2d216c62170915f to your computer and use it in GitHub Desktop.
require 'benchmark'
n = 100000
dv = Daru::Vector.new 1..n
# For current branch
Benchmark.bm do |x|
x.report do
100.times { dv[0] = nil }
end
x.report do
10.times do
dv[0] = nil
10.times { dv.reject_values nil }
end
end
end
require 'benchmark'
n = 100000
dv = Daru::Vector.new 1..n
# For master branch
Benchmark.bm do |x|
x.report do
100.times { dv[0] = nil }
end
x.report do
10.times do
dv[0] = nil
10.times { dv.only_valid nil }
end
end
end
# Missing values Branch
user system total real
0.000000 0.000000 0.000000 ( 0.000308)
11.120000 0.160000 11.280000 ( 11.385459)
# Master branch
user system total real
1.840000 0.000000 1.840000 ( 1.840055)
15.080000 0.060000 15.140000 ( 15.462978)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment