Class: BenchmarkRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/benchmark_runner.rb

Constant Summary collapse

REPO_ROOT =
File.expand_path(File.join(__dir__, "..", ".."))
DEFAULT_RUN_TIME =

Benchmark configuration

5
DEFAULT_WARMUP =
2
CATEGORIES =

Category definitions with descriptions

{
  xmi_parsing: {
    name: "XMI Parsing",
    icon: "📄",
    description: "XMI parsing performance tests. Measures how quickly we can convert XMI files into Ruby objects.",
    failure_means: "Slow XMI parsing impacts all downstream operations. A regression here means users will experience delays when processing XMI documents.",
    compare_against: "Previous branch (main).",
  },
}.freeze
BENCHMARKS =

Test definitions

{
  xmi_parsing: [
    { name: "XMI 2.4.2 (small)", method: :xmi_parse_242_small,
      desc: "XMI 2.4.2 ~100KB file" },
    { name: "XMI 2.4.2 (medium)", method: :xmi_parse_242_medium,
      desc: "XMI 2.4.2 ~500KB file with extensions" },
    { name: "XMI 2.4.2 (large)", method: :xmi_parse_242_large,
      desc: "XMI 2.4.2 ~3.5MB file" },
    { name: "XMI 2.5.1", method: :xmi_parse_251,
      desc: "XMI 2.5.1 ~100KB file" },
  ],
}.freeze
FIXTURES =

Test data - fixture paths

{
  xmi_parse_242_small: "spec/fixtures/xmi-v2-4-2-default.xmi",
  xmi_parse_242_medium: "spec/fixtures/xmi-v2-4-2-default-with-citygml.xmi",
  xmi_parse_242_large: "spec/fixtures/full-242.xmi",
  xmi_parse_251: "spec/fixtures/ea-xmi-2.5.1.xmi",
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(run_time: nil, warmup: nil, benchmark: nil) ⇒ BenchmarkRunner

Returns a new instance of BenchmarkRunner.



110
111
112
113
114
115
116
117
# File 'lib/tasks/benchmark_runner.rb', line 110

def initialize(run_time: nil, warmup: nil, benchmark: nil)
  @run_time = run_time || DEFAULT_RUN_TIME
  @warmup = warmup || DEFAULT_WARMUP
  @benchmark = benchmark
  @results = {}
  @env_shown = false
  @all_results = []
end

Instance Method Details

#run_benchmarksObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/tasks/benchmark_runner.rb', line 119

def run_benchmarks
  Term.header("XMI Performance Benchmarks", color: Term::CYAN)

  unless @env_shown
    Term.env_info(RUBY_VERSION, RUBY_PLATFORM)
    @env_shown = true
  end

  BENCHMARKS.each do |category, tests|
    run_category(category, tests)
  end

  print_summary

  @results
end