From e7ff6cc2aed5183fba74f15e11ac41bda1fd9e84 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Mon, 7 Oct 2019 21:24:36 +0530 Subject: [PATCH] New upstream version 12.1.14 --- CHANGELOG.md | 4 +++ VERSION | 2 +- .../.github/workflows/check_changelog.yml | 10 +++++++ derailed-benchmarks/CHANGELOG.md | 4 +++ derailed-benchmarks/README.md | 3 --- .../derailed_benchmarks.gemspec | 2 +- .../gemfiles/rails_6_0.gemfile | 2 +- .../core_ext/kernel_require.rb | 8 ++++++ .../lib/derailed_benchmarks/stats_from_dir.rb | 27 +++++++++++-------- .../lib/derailed_benchmarks/tasks.rb | 2 +- .../lib/derailed_benchmarks/version.rb | 2 +- .../stats_from_dir_test.rb | 14 ++++++---- .../test/rails_app/config/environment.rb | 4 ++- .../test/rails_app/db/schema.rb | 1 - derailed-benchmarks/test/test_helper.rb | 15 ++++++----- 15 files changed, 68 insertions(+), 32 deletions(-) create mode 100644 derailed-benchmarks/.github/workflows/check_changelog.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 205bf01e53..986cecc380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. +## 12.1.14 + +- No changes. + ## 12.1.13 ### Security (1 change) diff --git a/VERSION b/VERSION index a31e190c35..0e461ef2a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12.1.13 +12.1.14 diff --git a/derailed-benchmarks/.github/workflows/check_changelog.yml b/derailed-benchmarks/.github/workflows/check_changelog.yml new file mode 100644 index 0000000000..76398a0300 --- /dev/null +++ b/derailed-benchmarks/.github/workflows/check_changelog.yml @@ -0,0 +1,10 @@ +name: Check Changelog +on: [pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Check that CHANGELOG is touched + run: | + cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md diff --git a/derailed-benchmarks/CHANGELOG.md b/derailed-benchmarks/CHANGELOG.md index 96a8d7724c..ded910973c 100644 --- a/derailed-benchmarks/CHANGELOG.md +++ b/derailed-benchmarks/CHANGELOG.md @@ -1,5 +1,9 @@ # A Log of Changes! +## 1.4.1 + +- Rake dependency now allows for Rake 13 (https://github.com/schneems/derailed_benchmarks/pull/151) + ## 1.4.0 - Allow configuration of `perf:ips` benchmark. diff --git a/derailed-benchmarks/README.md b/derailed-benchmarks/README.md index 76b3dc9d0a..8f309691b7 100644 --- a/derailed-benchmarks/README.md +++ b/derailed-benchmarks/README.md @@ -443,9 +443,6 @@ When the test is done it will output which commit "won" and by how much: 1.0870x [older/newer] 8.0026% [(older - newer) / older * 100] [13d6aa3a7b] "Merge pull request #36284 from kamipo/fix_eager_loading_with_string_joins" - (11.9255485 seconds) - -P-value: 4.635595463712749e-05 -Is significant? (P-value < 0.05): true ``` You can provide this to the Rails team along with the example app you used to benchmark (so they can independently verify if needed). diff --git a/derailed-benchmarks/derailed_benchmarks.gemspec b/derailed-benchmarks/derailed_benchmarks.gemspec index 1714ed6e4c..a58b0d7a2e 100644 --- a/derailed-benchmarks/derailed_benchmarks.gemspec +++ b/derailed-benchmarks/derailed_benchmarks.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |gem| gem.add_dependency "get_process_mem", "~> 0" gem.add_dependency "benchmark-ips", "~> 2" gem.add_dependency "rack", ">= 1" - gem.add_dependency "rake", "> 10", "< 13" + gem.add_dependency "rake", "> 10", "< 14" gem.add_dependency "thor", "~> 0.19" gem.add_dependency "ruby-statistics", ">= 2.1" diff --git a/derailed-benchmarks/gemfiles/rails_6_0.gemfile b/derailed-benchmarks/gemfiles/rails_6_0.gemfile index ac0cf76ff0..0a38f6db57 100644 --- a/derailed-benchmarks/gemfiles/rails_6_0.gemfile +++ b/derailed-benchmarks/gemfiles/rails_6_0.gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" -gem "rails", "6.0.0.rc1" +gem "rails", "6.0.0" group :development, :test do gem "sqlite3", platform: [:ruby, :mswin, :mingw] diff --git a/derailed-benchmarks/lib/derailed_benchmarks/core_ext/kernel_require.rb b/derailed-benchmarks/lib/derailed_benchmarks/core_ext/kernel_require.rb index c21d340b8a..cbb5f01328 100644 --- a/derailed-benchmarks/lib/derailed_benchmarks/core_ext/kernel_require.rb +++ b/derailed-benchmarks/lib/derailed_benchmarks/core_ext/kernel_require.rb @@ -77,6 +77,14 @@ Kernel.define_singleton_method(:require) do |file| end end +class Object + private + + def require(path) + Kernel.require(path) + end +end + # Don't forget to assign a cost to the top level cost_before_requiring_anything = GetProcessMem.new.mb TOP_REQUIRE.cost = cost_before_requiring_anything diff --git a/derailed-benchmarks/lib/derailed_benchmarks/stats_from_dir.rb b/derailed-benchmarks/lib/derailed_benchmarks/stats_from_dir.rb index afd6fe9720..c47976fa1b 100644 --- a/derailed-benchmarks/lib/derailed_benchmarks/stats_from_dir.rb +++ b/derailed-benchmarks/lib/derailed_benchmarks/stats_from_dir.rb @@ -42,16 +42,14 @@ module DerailedBenchmarks def call @files.each(&:call) - @stats = students_t_test + @stats = statistical_test self end - def students_t_test(series_1=oldest.values, series_2=newest.values) - StatisticalTest::TTest.perform( - alpha = 0.05, - :two_tail, - series_1, - series_2 + def statistical_test(series_1=oldest.values, series_2=newest.values) + StatisticalTest::KSTest.two_samples( + group_one: series_1, + group_two: series_2 ) end @@ -59,8 +57,12 @@ module DerailedBenchmarks @stats[:alternative] end - def p_value - @stats[:p_value].to_f + def d_max + @stats[:d_max].to_f + end + + def d_critical + @stats[:d_critical].to_f end def x_faster @@ -91,8 +93,11 @@ module DerailedBenchmarks io.puts io.puts "Iterations per sample: #{ENV["TEST_COUNT"]}" io.puts "Samples: #{newest.values.length}" - io.puts "P-value: #{p_value}" - io.puts "Is significant? (P-value < 0.05): #{significant?}" + io.puts + io.puts "Test type: Kolmogorov Smirnov" + io.puts "Is significant? (max > critical): #{significant?}" + io.puts "D critical: #{d_critical}" + io.puts "D max: #{d_max}" io.puts end end diff --git a/derailed-benchmarks/lib/derailed_benchmarks/tasks.rb b/derailed-benchmarks/lib/derailed_benchmarks/tasks.rb index 050fc6ca40..c6477a55bb 100644 --- a/derailed-benchmarks/lib/derailed_benchmarks/tasks.rb +++ b/derailed-benchmarks/lib/derailed_benchmarks/tasks.rb @@ -53,7 +53,7 @@ namespace :perf do end stats = DerailedBenchmarks::StatsFromDir.new(branch_info) - ENV["DERAILED_STOP_VALID_COUNT"] ||= "10" + ENV["DERAILED_STOP_VALID_COUNT"] ||= "50" stop_valid_count = Integer(ENV["DERAILED_STOP_VALID_COUNT"]) times_significant = 0 diff --git a/derailed-benchmarks/lib/derailed_benchmarks/version.rb b/derailed-benchmarks/lib/derailed_benchmarks/version.rb index 8959f37568..0f965a9372 100644 --- a/derailed-benchmarks/lib/derailed_benchmarks/version.rb +++ b/derailed-benchmarks/lib/derailed_benchmarks/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module DerailedBenchmarks - VERSION = "1.4.0" + VERSION = "1.4.1" end diff --git a/derailed-benchmarks/test/derailed_benchmarks/stats_from_dir_test.rb b/derailed-benchmarks/test/derailed_benchmarks/stats_from_dir_test.rb index 73aa80bef9..8b4a45a4c4 100644 --- a/derailed-benchmarks/test/derailed_benchmarks/stats_from_dir_test.rb +++ b/derailed-benchmarks/test/derailed_benchmarks/stats_from_dir_test.rb @@ -18,8 +18,8 @@ class StatsFromDirTest < ActiveSupport::TestCase assert_equal "winner", newest.name assert_equal "loser", oldest.name - assert 3.6e-05 < stats.p_value - assert 3.8e-05 > stats.p_value + assert_in_delta 0.26, stats.d_max, 0.01 + assert_in_delta 0.1730818382602285, stats.d_critical, 0.00001 assert_equal true, stats.significant? assert_equal "1.0062", stats.x_faster @@ -36,8 +36,12 @@ class StatsFromDirTest < ActiveSupport::TestCase oldest = stats.oldest # Test fixture for banner - def stats.p_value - "0.000037" + def stats.d_max + "0.037" + end + + def stats.d_critical + "0.001" end def newest.average @@ -95,7 +99,7 @@ EOM test "stats from samples with slightly different sizes" do stats = DerailedBenchmarks::StatsFromDir.new({}) - out = stats.students_t_test([100,101,102], [1,3]) + out = stats.statistical_test([100,101,102, 100, 101, 99], [1,3, 3, 2]) assert out[:alternative] end end diff --git a/derailed-benchmarks/test/rails_app/config/environment.rb b/derailed-benchmarks/test/rails_app/config/environment.rb index 7c1bfa8dde..c5310379f6 100644 --- a/derailed-benchmarks/test/rails_app/config/environment.rb +++ b/derailed-benchmarks/test/rails_app/config/environment.rb @@ -4,6 +4,8 @@ require File.expand_path('../application', __FILE__) # Initialize the rails application -Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true +if Rails.application.config.active_record.sqlite3.respond_to?(:represent_boolean_as_integer) + Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true +end Dummy::Application.initialize! diff --git a/derailed-benchmarks/test/rails_app/db/schema.rb b/derailed-benchmarks/test/rails_app/db/schema.rb index 925dcc7454..b499accd18 100644 --- a/derailed-benchmarks/test/rails_app/db/schema.rb +++ b/derailed-benchmarks/test/rails_app/db/schema.rb @@ -32,5 +32,4 @@ ActiveRecord::Schema.define(version: 20141210070547) do add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - end diff --git a/derailed-benchmarks/test/test_helper.rb b/derailed-benchmarks/test/test_helper.rb index d3e271fb29..1a0119b612 100644 --- a/derailed-benchmarks/test/test_helper.rb +++ b/derailed-benchmarks/test/test_helper.rb @@ -29,16 +29,19 @@ Capybara.default_driver = :rack_test Capybara.default_selector = :css require_relative "rails_app/config/environment" -ActiveRecord::Migrator.migrations_paths = [File.expand_path("../rails_app/db/migrate", __dir__)] -if Rails.gem_version >= Gem::Version.new('5.2.0') - ActiveRecord::MigrationContext - .new(File.expand_path("../rails_app/db/migrate/", __FILE__)) - .migrate +# https://github.com/plataformatec/devise/blob/master/test/orm/active_record.rb +migrate_path = File.expand_path("../rails_app/db/migrate", __FILE__) +if Rails.version.start_with? '6' + ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).migrate +elsif Rails.version.start_with? '5.2' + ActiveRecord::MigrationContext.new(migrate_path).migrate else - ActiveRecord::Migrator.migrate(File.expand_path("../rails_app/db/migrate/", __FILE__)) + ActiveRecord::Migrator.migrate(migrate_path) end +ActiveRecord::Migration.maintain_test_schema! + # Load support files Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }