Module: RDF::Benchmark

Defined in:
lib/rdf/benchmark.rb,
lib/rdf/benchmark/repository.rb,
lib/rdf/benchmark/berlin_generator.rb

Defined Under Namespace

Classes: BerlinGenerator, Repository

Class Method Summary collapse

Class Method Details

.benchmark!(name:) { ... } ⇒ Benchmark::Report

Benchmarks a single run of the given block (with warmup).

Parameters:

  • name (String)

Yields:

  • runs the block as a Benchmark#bmbm report

Returns:

  • (Benchmark::Report)

See Also:

  • Benchmark#bmbm


32
33
34
35
36
# File 'lib/rdf/benchmark.rb', line 32

def self.benchmark!(name:, &block)
  ::Benchmark.bmbm do |bm|
    bm.report(name, &block)
  end
end

.benchmark_ips!(name:, time: 5, warmup: 2) { ... } ⇒ Benchmark::IPS::Report

Benchmarks the given block, measuring iterations per second.

Parameters:

  • name (String)
  • time (Integer) (defaults to: 5)
  • warmup (Integer) (defaults to: 2)

Yields:

  • runs the block repeatedly as a Benchmark#ips report

Returns:

  • (Benchmark::IPS::Report)

See Also:

  • Benchmark#ips


17
18
19
20
21
22
# File 'lib/rdf/benchmark.rb', line 17

def self.benchmark_ips!(name: , time: 5, warmup: 2, &block)
  ::Benchmark.ips do |bm|
    bm.config(:time => time, :warmup => warmup)
    bm.report(name, &block)
  end
end