Sha256: fa8159e11cc3a3f23dafbbb827800cebef527eabb60cf752a3436c3a19a30934

Contents?: true

Size: 683 Bytes

Versions: 6

Compression:

Stored size: 683 Bytes

Contents

lib = File.expand_path('../lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'benchmark/ips'
require 'character_set'
if RUBY_VERSION.to_f >= 3.0 && !RUBY_PLATFORM[/java/i]
  require 'sorted_set'
else
  require 'set'
end

def benchmark(caption: nil, cases: {})
  puts caption

  report = Benchmark.ips do |x|
    cases.each do |label, callable|
      x.report(label, &callable)
    end
    x.compare!
  end

  return unless $store_comparison_results

  old_stdout = $stdout.clone
  captured_stdout = StringIO.new
  $stdout = captured_stdout
  report.run_comparison
  $store_comparison_results[caption] = captured_stdout.string
  $stdout = old_stdout
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
character_set-1.6.0-java benchmarks/shared.rb
character_set-1.6.0 benchmarks/shared.rb
character_set-1.5.0-java benchmarks/shared.rb
character_set-1.5.0 benchmarks/shared.rb
character_set-1.4.1-java benchmarks/shared.rb
character_set-1.4.1 benchmarks/shared.rb