Sha256: 9b8be80908b827445b981e11619554f2f98e6da46116bd541295e393a9423d79

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

Stored size: 660 Bytes

Contents

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

require 'benchmark'
require 'daru_lite'

df = DaruLite::DataFrame.new({
  a: [1,2,3,4,5,6]*100,
  b: ['a','b','c','d','e','f']*100,
  c: [11,22,33,44,55,66]*100
}, index: (1..600).to_a.shuffle)

Benchmark.bm do |x|
  x.report("where") do
    df.where(df[:a].eq(2) | df[:c].eq(55))
  end

  x.report("filter_rows") do
    df.filter(:row) do |r|
      r[:a] == 2 or r[:c] == 55
    end
  end
end

#             ===== Benchmarks =====
#
#                user     system      total        real
# where        0.000000   0.000000   0.000000 (  0.002575)
# filter_rows  0.210000   0.000000   0.210000 (  0.205403)

Version data entries

4 entries across 4 versions & 1 rubygems

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