1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
# frozen_string_literal: true
# Run `bundle exec rake benchmark` to execute benchmark.
# This is very much a work-in-progress. Please feel free to make/suggest improvements!
require "benchmark/ips"
# Configure Rails Environment
ENV["RAILS_ENV"] = "production"
require File.expand_path("../test/sandbox/config/environment.rb", __dir__)
module Performance
require_relative "components/new_inline_component"
end
class BenchmarksController < ActionController::Base
end
BenchmarksController.view_paths = [File.expand_path("./views", __dir__)]
controller_view = BenchmarksController.new.view_context
Benchmark.ips do |x|
x.time = 10
x.warmup = 2
x.report("inline_component") do
controller_view.render(Performance::NewInlineComponent.new(name: "Reegan"))
end
x.compare!
end
|