Sha256: 968704e5355b3f0138b163584d8a35eb7bdbebed643ce1a96e1554a5f04cdd37

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

$:.unshift File.expand_path("../../lib", __FILE__)

require 'benchmark'
require 'daru_lite'

Benchmark.bm do |x|
  x.report("Create with Arrays and clone") do
    df = DaruLite::DataFrame.new({
      a: 100000.times.map { rand },
      b: 100000.times.map { rand },
      c: 100000.times.map { rand }
    })
  end

  x.report("Create with Vectors and clone") do
    df = DaruLite::DataFrame.new({
      a: DaruLite::Vector.new(100000.times.map { rand }),
      b: DaruLite::Vector.new(100000.times.map { rand }),
      c: DaruLite::Vector.new(100000.times.map { rand })
    })
  end

  x.report("Create with Vector and dont clone") do
    df = DaruLite::DataFrame.new({
      a: DaruLite::Vector.new(100000.times.map { rand }),
      b: DaruLite::Vector.new(100000.times.map { rand }),
      c: DaruLite::Vector.new(100000.times.map { rand })
    }, clone: false)
  end

  x.report("Create by row from Arrays") do
  end
end

#                           ===== Benchmarks =====
#                                       user     system      total        real
# Create with Arrays and clone       0.940000   0.010000   0.950000 (  0.959851)
# Create with Vectors and clone      1.950000   0.020000   1.970000 (  1.966835)
# Create with Vector and dont clone  1.170000   0.000000   1.170000 (  1.177132)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daru_lite-0.1.3 benchmarks/dataframe_creation.rb
daru_lite-0.1.2 benchmarks/dataframe_creation.rb
daru_lite-0.1.1 benchmarks/dataframe_creation.rb
daru_lite-0.1 benchmarks/dataframe_creation.rb