From b41fa4988a50100d36457dff259d0f68455174ca Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 Aug 2013 21:23:00 +1000 Subject: [PATCH] update rails 4 ensure you clear the tmp/cache folder on each bench (so results are correct, there is an incompat upgrade) add facter gem which will be used to collect hardware data from the bencher --- Gemfile_rails4.lock | 2 +- config/environments/profile.rb | 2 +- script/bench.rb | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Gemfile_rails4.lock b/Gemfile_rails4.lock index 7f387e83f..de3fc0bac 100644 --- a/Gemfile_rails4.lock +++ b/Gemfile_rails4.lock @@ -33,7 +33,7 @@ GIT GIT remote: git://github.com/rails/rails.git - revision: e36692a7466011ab51393ac8ca6dfffcb9d79ec0 + revision: 78624ffedbf98c49743a60e00aa1351c9a48f54b branch: 4-0-stable specs: actionmailer (4.0.0) diff --git a/config/environments/profile.rb b/config/environments/profile.rb index d2aa9c330..2e51ad468 100644 --- a/config/environments/profile.rb +++ b/config/environments/profile.rb @@ -37,7 +37,7 @@ Discourse::Application.configure do config.handlebars.precompile = true # this setting enable rack_cache so it caches various requests in redis - # config.enable_rack_cache = true + config.enable_rack_cache = false # allows users to use mini profiler config.enable_mini_profiler = false diff --git a/script/bench.rb b/script/bench.rb index 37dacb551..7c7cd5831 100644 --- a/script/bench.rb +++ b/script/bench.rb @@ -2,12 +2,21 @@ require "socket" require "csv" require "yaml" -@timings = {} - def run(command) system(command, out: $stdout, err: :out) end +begin + require 'facter' +rescue LoadError + run "gem install facter" + puts "just installed the facter gem, please re-run script" + exit +end + +@timings = {} + + def measure(name) start = Time.now yield @@ -98,6 +107,8 @@ def bench(path) end begin + # critical cause cache may be incompatible or something + `rm -fr tmp/cache` pid = spawn("bundle exec thin start -p #{@port}") while port_available? @port @@ -119,6 +130,8 @@ begin "rails4?" => ENV["RAILS4"] == "1" }.to_yaml) + # TODO include Facter.to_hash ... for all facts + ensure Process.kill "KILL", pid end