Sha256: a195d44f58f7dd9672239bae1993fb1c7250e2ca099543c35173da18fae973c2
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 KB
Contents
#!/usr/bin/env ruby require 'bundler/setup' require 'honey_format' require 'benchmark/ips' require 'csv' require 'honey_format/cli/benchmark_cli' cli = HoneyFormat::BenchmarkCLI.new Writer = cli.writer options = cli.options input_path = options[:input_path] benchmark_time = options[:benchmark_time] benchmark_warmup = options[:benchmark_warmup] lines_multipliers = options[:lines_multipliers] original_csv = input_path ? File.read(input_path) : cli.fetch_default_benchmark_csv original_csv_lines = original_csv.lines runtime_seconds = cli.expected_runtime_seconds(report_count: 3) Writer.puts "Expected runtime: ~#{runtime_seconds} seconds.", verbose: true lines_multipliers.each_with_index do |lines_multiplier, index| rows = original_csv_lines[1..-1] * lines_multiplier csv = original_csv_lines.first + rows.join line_count = csv.lines.length Writer.puts "== Benchmark #{index + 1} of #{lines_multipliers.length} ==" Writer.puts "path #{cli.used_input_path}" Writer.puts "lines #{line_count}" Writer.puts "multiplier #{lines_multiplier}" Benchmark.ips do |x| x.time = benchmark_time x.warmup = benchmark_warmup x.report('CSV no options') { CSV.parse(csv) } x.report('CSV with header') { CSV.parse(csv, headers: true) } x.report('HoneyFormat::CSV') { HoneyFormat::CSV.new(csv).rows } x.compare! end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
honey_format-0.16.0 | bin/benchmark |
honey_format-0.15.0 | bin/benchmark |
honey_format-0.14.0 | bin/benchmark |
honey_format-0.13.0 | bin/benchmark |