Class: TheMechanic2::BenchmarkService
- Inherits:
-
Object
- Object
- TheMechanic2::BenchmarkService
- Defined in:
- lib/the_mechanic_2/benchmark_service.rb
Overview
Service for orchestrating benchmark execution Coordinates between RailsRunnerService and result formatting
Instance Method Summary collapse
-
#run(shared_setup:, code_a:, code_b:, timeout: 30) ⇒ Hash
Executes a benchmark comparison between two code snippets.
Instance Method Details
#run(shared_setup:, code_a:, code_b:, timeout: 30) ⇒ Hash
Executes a benchmark comparison between two code snippets
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/the_mechanic_2/benchmark_service.rb', line 13 def run(shared_setup:, code_a:, code_b:, timeout: 30) runner = RailsRunnerService.new # Execute code_a result_a = runner.execute( code: code_a, shared_setup: shared_setup, timeout: timeout ) # Execute code_b result_b = runner.execute( code: code_b, shared_setup: shared_setup, timeout: timeout ) # Format and return results format_results(result_a, result_b) end |