Sha256: ba5791fbdad6e531b51f6e26417c30a9d340605d53c0f1a1008e2fc729eefd41

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

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

require 'benchmark'
require 'daru'

Benchmark.bm do |x|
  x.report("Create with Arrays and clone") do
    df = Daru::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 = Daru::DataFrame.new({
      a: Daru::Vector.new(100000.times.map { rand }),
      b: Daru::Vector.new(100000.times.map { rand }),
      c: Daru::Vector.new(100000.times.map { rand })
    })
  end

  x.report("Create with Vector and dont clone") do
    df = Daru::DataFrame.new({
      a: Daru::Vector.new(100000.times.map { rand }),
      b: Daru::Vector.new(100000.times.map { rand }),
      c: Daru::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

12 entries across 12 versions & 1 rubygems

Version Path
daru-0.3 benchmarks/dataframe_creation.rb
daru-0.2.2 benchmarks/dataframe_creation.rb
daru-0.2.1 benchmarks/dataframe_creation.rb
daru-0.2.0 benchmarks/dataframe_creation.rb
daru-0.1.6 benchmarks/dataframe_creation.rb
daru-0.1.5 benchmarks/dataframe_creation.rb
daru-0.1.4.1 benchmarks/dataframe_creation.rb
daru-0.1.4 benchmarks/dataframe_creation.rb
daru-0.1.3.1 benchmarks/dataframe_creation.rb
daru-0.1.3 benchmarks/dataframe_creation.rb
daru-0.1.2 benchmarks/dataframe_creation.rb
daru-0.1.1 benchmarks/dataframe_creation.rb