Sha256: 3216f7c9c8e90e9052dc6aa91e5f0518a99fb488c3760d4026f0486a8aae101a
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 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 } }) Benchmark.bm do |x| x.report("Access single row") do df.row[50] end x.report("Access rows by comma") do df.row[*(5..40000).to_a.shuffle] end x.report("Individual rows") do rows = [] index = (5..40000).to_a.shuffle index.each do |a| rows << df.row[a].to_a end DaruLite::DataFrame.rows(rows, order: [:a,:b,:c], index: index) end x.report("Access rows by range") do df.row[5..40000] end end # ==== Benchmarks ==== # user system total real # Access single row 0.000000 0.000000 0.000000 ( 0.000059) # Access rows by comma 1.410000 0.010000 1.420000 ( 1.420426) # Individual rows 1.480000 0.000000 1.480000 ( 1.488531) # Access rows by range 1.440000 0.010000 1.450000 ( 1.436750)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
daru_lite-0.1.3 | benchmarks/row_access.rb |
daru_lite-0.1.2 | benchmarks/row_access.rb |
daru_lite-0.1.1 | benchmarks/row_access.rb |
daru_lite-0.1 | benchmarks/row_access.rb |