Sha256: 5bfb31709ad3cb0682df7b349c0c3155c16b6f7213591c0ff5dec30943517999

Contents?: true

Size: 1.03 KB

Versions: 15

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'

gemspec = Dir.glob(File.expand_path("../../*.gemspec", __FILE__)).first
spec = Gem::Specification.load(gemspec)

# Add the require paths to the $LOAD_PATH
spec.require_paths.each do |path|
  full_path = File.expand_path("../" + path, __dir__)
  $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
end

spec.require_paths.each do |path|
  require "./lib/prefab-cloud-ruby"
end

require 'prefab-cloud-ruby'
require 'benchmark/ips'

prefab = Prefab::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
                            context_upload_mode: :none)

prefab.get('prefab.auth.allowed_origins')

prefab.with_context(user: { email_suffix: 'yahoo.com' }) do
  Benchmark.ips do |x|
    x.report("noop") do
    end

    x.report('prefab.get') do
      prefab.get('prefab.auth.allowed_origins')
    end

    x.report('prefab.get with jit context') do
      prefab.get('prefab.auth.allowed_origins', { a: { b: "c" } })
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
prefab-cloud-ruby-1.8.8 dev/benchmark
prefab-cloud-ruby-1.8.8.pre.1 dev/benchmark
prefab-cloud-ruby-1.8.7 dev/benchmark
prefab-cloud-ruby-1.8.6 dev/benchmark
prefab-cloud-ruby-1.8.5 dev/benchmark
prefab-cloud-ruby-1.8.4 dev/benchmark
prefab-cloud-ruby-1.8.3 dev/benchmark
prefab-cloud-ruby-1.8.2 dev/benchmark
prefab-cloud-ruby-1.8.1 dev/benchmark
prefab-cloud-ruby-1.8.0 dev/benchmark
prefab-cloud-ruby-1.7.2 dev/benchmark
prefab-cloud-ruby-1.7.1 dev/benchmark
prefab-cloud-ruby-1.7.0 dev/benchmark
prefab-cloud-ruby-1.6.2 dev/benchmark
prefab-cloud-ruby-1.6.1 dev/benchmark