Sha256: a1b11dd260aab704246f5a9c3d678f732f8227e4a405933f4dd597b98a0d5a5d
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
$:.unshift File.expand_path("../../lib", __FILE__) require 'benchmark' require 'daru_lite' df = DaruLite::DataFrame.new({ a: 100000.times.map { rand }, b: 100000.times.map { rand }, c: 100000.times.map { rand } }) index = DaruLite::Index.new((0...100000).to_a.shuffle) Benchmark.bm do |x| x.report("Assign new vector as Array") do df[:d] = 100000.times.map { rand } end x.report("Reassign same vector as Array") do df[:a] = 100000.times.map { rand } end x.report("Assign new Vector as DaruLite::Vector") do df[:e] = DaruLite::Vector.new(100000.times.map { rand }) end x.report("Reassign same Vector as DaruLite::Vector") do df[:b] = DaruLite::Vector.new(100000.times.map { rand }) end x.report("Reassgin differently indexed DaruLite::Vector") do df[:b] = DaruLite::Vector.new(100000.times.map { rand }, index: index) end end # ===== Benchmarks ===== # user system total real # Assign new vector as Array 0.370000 0.000000 0.370000 (0.364515) # Reassign same vector as Array 0.470000 0.000000 0.470000 (0.471408) # Assign new Vector as DaruLite::Vector 0.940000 0.000000 0.940000 (0.947879) # Reassign same Vector as DaruLite::Vector 0.760000 0.020000 0.780000 (0.769969) # Reassgin differently indexed DaruLite::Vector <Too embarassingly slow.>
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
daru_lite-0.1.3 | benchmarks/vector_assign.rb |
daru_lite-0.1.2 | benchmarks/vector_assign.rb |
daru_lite-0.1.1 | benchmarks/vector_assign.rb |
daru_lite-0.1 | benchmarks/vector_assign.rb |