benchmark/group.yml
loop_count: 3
contexts:
- name: 0.3.0
gems:
red_amber: 0.3.0
- name: 0.4.2
gems:
red_amber: 0.4.2
- name: HEAD
prelude: |
$LOAD_PATH.unshift(File.expand_path('lib'))
prelude: |
require 'red_amber'
include RedAmber
require 'datasets-arrow'
ds = Datasets::Rdatasets.new('nycflights13', 'flights')
df = RedAmber::DataFrame.new(ds.to_arrow)
.assign(:flight) { flight.map(&:to_s) }
slicer = df[:distance] > 1000
distance_km = df[:distance] * 1.852
benchmark:
'G01: sum distance by destination': |
df.group(:dest).sum(:distance)
'G02: sum arr_delay by month and day': |
df.group(:month, :day).sum(:arr_delay)
'G03: sum arr_delay, mean distance by flight': |
df.group(:flight) { [sum(:arr_delay), mean(:distance)] }
'G04:filtersir_time, distance by flight': |
df.group(:flight).mean(:air_time, :distance)
'G75: sum dep_delay, arr_delay by carrer': |
df.group(:carrier).sum(:dep_delay, :arr_delay)
'G06: filters': |
Group.new(df, :dest).filters
'G07: inspect': |
Group.new(df, :dest).inspect