1. 08 9月, 2015 9 次提交
  2. 07 9月, 2015 14 次提交
    • A
      Typo fix [ci skip] · 1678bf24
      amitkumarsuroliya 提交于
      `lengh` should be `length`  
      1678bf24
    • Y
      Merge pull request #20534 from qnm/activesupport-require-issue · 92d17007
      Yves Senn 提交于
      Add require to ensure Time#advance works without implicit required
      92d17007
    • Y
      Merge pull request #21527 from rngtng/fix-migrator-path-setup · 8e155b0a
      Yves Senn 提交于
      Use global migrations_path configuration in Migrator
      8e155b0a
    • T
    • Y
      changelog, minor formatting changes. · 488afd5c
      Yves Senn 提交于
      488afd5c
    • A
      Merge pull request #21524 from gfx/do_not_localize_for_to_sentence · 3f2267eb
      Akira Matsuda 提交于
      Fix strange messages for `rails g foo`
      3f2267eb
    • F
      Fix strange messages for `rails g foo` · 3215c6b7
      FUJI Goro (gfx) 提交于
      3215c6b7
    • G
      PERF: Don't create a Relation when it is not needed. · 69de09c5
      Guo Xiang Tan 提交于
      Benchmark script used:
      ```
      begin
        require 'bundler/inline'
      rescue LoadError => e
        $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
        raise e
      end
      
      gemfile(true) do
        source 'https://rubygems.org'
        gem 'rails', path: '~/rails' # master against ref "f1f0a3f8"
        gem 'arel', github: 'rails/arel', branch: 'master'
        gem 'rack', github: 'rack/rack', branch: 'master'
        gem 'sass'
        gem 'sprockets-rails', github: 'rails/sprockets-rails', branch: 'master'
        gem 'sprockets', github: 'rails/sprockets', branch: 'master'
        gem 'pg'
        gem 'benchmark-ips'
      end
      
      require 'active_record'
      require 'benchmark/ips'
      
      ActiveRecord::Base.establish_connection('postgres://postgres@localhost:5432/rubybench')
      
      ActiveRecord::Migration.verbose = false
      
      ActiveRecord::Schema.define do
        create_table :users, force: true do |t|
          t.string :name, :email
          t.timestamps null: false
        end
      end
      
      class User < ActiveRecord::Base; end
      
      attributes = {
        name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        email: "foobar@email.com",
      }
      
      1000.times { User.create!(attributes) }
      
      Benchmark.ips(5, 3) do |x|
        x.report('all') { User.all }
      end
      
      key =
        if RUBY_VERSION < '2.2'
          :total_allocated_object
        else
          :total_allocated_objects
        end
      
      before = GC.stat[key]
      User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
      after = GC.stat[key]
      puts "Total Allocated Object: #{after - before}"
      
      ```
      
      Before:
      ```
      Calculating -------------------------------------
                       all    17.569k i/100ms
      -------------------------------------------------
                       all    190.854k (± 3.3%) i/s -    966.295k
      Total Allocated Object: 85
      ```
      
      After:
      ```
      Calculating -------------------------------------
                       all    22.237k i/100ms
      -------------------------------------------------
                       all    262.715k (± 5.5%) i/s -      1.312M
      Total Allocated Object: 80
      ```
      69de09c5
    • Y
      Merge pull request #21250 from ronakjangir47/safe_const · 2aad0b41
      Yves Senn 提交于
      safe_constantize - Added Object scoped missing test cases
      2aad0b41
    • K
      Merge pull request #21480 from amitsuroliya/add_return_value_description · b5a489fc
      Kasper Timm Hansen 提交于
      adding description of return value [ci skip]
      b5a489fc
    • G
      Cache check if `default_scope` has been overridden. · 52b2ab9e
      Guo Xiang Tan 提交于
      Benchmark Script:
      ```
      begin
        require 'bundler/inline'
      rescue LoadError => e
        $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
        raise e
      end
      
      gemfile(true) do
        source 'https://rubygems.org'
        # gem 'rails', github: 'rails/rails', ref: 'f1f0a3f8'
        gem 'rails', path: '~/rails'
        gem 'arel', github: 'rails/arel', branch: 'master'
        gem 'rack', github: 'rack/rack', branch: 'master'
        gem 'sass'
        gem 'sprockets-rails', github: 'rails/sprockets-rails', branch: 'master'
        gem 'sprockets', github: 'rails/sprockets', branch: 'master'
        gem 'pg'
        gem 'benchmark-ips'
      end
      
      require 'active_record'
      require 'benchmark/ips'
      
      ActiveRecord::Base.establish_connection('postgres://postgres@localhost:5432/rubybench')
      
      ActiveRecord::Migration.verbose = false
      
      ActiveRecord::Schema.define do
        create_table :users, force: true do |t|
          t.string :name, :email
          t.timestamps null: false
        end
      end
      
      class User < ActiveRecord::Base; end
      
      attributes = {
        name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        email: "foobar@email.com",
      }
      
      1000.times { User.create!(attributes) }
      
      Benchmark.ips(5, 3) do |x|
        x.report('where with hash') { User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
        x.report('where with string') { User.where("users.name = ?", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
        x.compare!
      end
      
      key =
        if RUBY_VERSION < '2.2'
          :total_allocated_object
        else
          :total_allocated_objects
        end
      
      before = GC.stat[key]
      User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
      after = GC.stat[key]
      puts "Total Allocated Object: #{after - before}"
      ```
      
      Stackprof output truncated.
      ```
      TOTAL    (pct)     SAMPLES    (pct)     FRAME
         52  (10.6%)          10   (2.0%)     ActiveRecord::Scoping::Default::ClassMethods#build_default_scope
      ```
      
      Before:
      ```
      Calculating -------------------------------------
           where with hash     2.789k i/100ms
         where with string     4.407k i/100ms
      -------------------------------------------------
           where with hash     29.170k (± 1.9%) i/s -    147.817k
         where with string     46.954k (± 2.7%) i/s -    237.978k
      
      Comparison:
         where with string:    46954.3 i/s
           where with hash:    29169.9 i/s - 1.61x slower
      
      Total Allocated Object: 85
      Calculating -------------------------------------
                       all    16.773k i/100ms
      -------------------------------------------------
                       all    186.102k (± 3.6%) i/s -    939.288k
      ```
      
      After:
      ```
      Calculating -------------------------------------
           where with hash     3.014k i/100ms
         where with string     4.623k i/100ms
      -------------------------------------------------
           where with hash     31.524k (± 1.3%) i/s -    159.742k
         where with string     49.948k (± 2.3%) i/s -    249.642k
      
      Comparison:
         where with string:    49948.3 i/s
           where with hash:    31524.3 i/s - 1.58x slower
      
      Total Allocated Object: 84
      Calculating -------------------------------------
                       all    20.139k i/100ms
      -------------------------------------------------
                       all    227.860k (± 2.5%) i/s -      1.148M
      ```
      52b2ab9e
    • G
      Reduce calls to stringify_keys. · 47e06c98
      Guo Xiang Tan 提交于
      Stackprof output truncated.
      ```
      TOTAL    (pct)     SAMPLES    (pct)     FRAME
        23   (4.7%)          12   (2.4%)     Hash#transform_keys
        11   (2.2%)          11   (2.2%)     block in Hash#transform_keys
        30   (6.1%)           7   (1.4%)     Hash#stringify_keys
      ```
      
      Benchmark Script:
      ```
      begin
        require 'bundler/inline'
      rescue LoadError => e
        $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
        raise e
      end
      
      gemfile(true) do
        source 'https://rubygems.org'
        gem 'rails', path: '~/rails' # master against ref "f1f0a3f8"
        gem 'arel', github: 'rails/arel', branch: 'master'
        gem 'rack', github: 'rack/rack', branch: 'master'
        gem 'sass'
        gem 'sprockets-rails', github: 'rails/sprockets-rails', branch: 'master'
        gem 'sprockets', github: 'rails/sprockets', branch: 'master'
        gem 'pg'
        gem 'benchmark-ips'
      end
      
      require 'active_record'
      require 'benchmark/ips'
      
      ActiveRecord::Base.establish_connection('postgres://postgres@localhost:5432/rubybench')
      
      ActiveRecord::Migration.verbose = false
      
      ActiveRecord::Schema.define do
        create_table :users, force: true do |t|
          t.string :name, :email
          t.timestamps null: false
        end
      end
      
      class User < ActiveRecord::Base; end
      
      attributes = {
        name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        email: "foobar@email.com",
      }
      
      1000.times { User.create!(attributes) }
      
      Benchmark.ips(5, 3) do |x|
        x.report('where with hash') { User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
        x.report('where with string') { User.where("users.name = ?", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
        x.compare!
      end
      
      key =
        if RUBY_VERSION < '2.2'
          :total_allocated_object
        else
          :total_allocated_objects
        end
      
      before = GC.stat[key]
      User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
      after = GC.stat[key]
      puts "Total Allocated Object: #{after - before}"
      ```
      
      Before:
      ```
      Calculating -------------------------------------
           where with hash     2.796k i/100ms
         where with string     4.338k i/100ms
      -------------------------------------------------
           where with hash     29.177k (± 1.5%) i/s -    148.188k
         where with string     47.419k (± 2.8%) i/s -    238.590k
      
      Comparison:
         where with string:    47419.0 i/s
           where with hash:    29176.6 i/s - 1.63x slower
      
      Total Allocated Object: 85
      ```
      
      After:
      ```
      Calculating -------------------------------------
           where with hash     2.895k i/100ms
         where with string     4.416k i/100ms
      -------------------------------------------------
           where with hash     30.758k (± 2.0%) i/s -    156.330k
         where with string     47.708k (± 2.6%) i/s -    238.464k
      
      Comparison:
         where with string:    47707.9 i/s
           where with hash:    30757.7 i/s - 1.55x slower
      
      Total Allocated Object: 84
      ```
      47e06c98
    • R
      Merge pull request #21521 from yui-knk/fix/ar_task_desc · ff21abee
      Richard Schneeman 提交于
      [ci skip] Replace `AR` with `Active Record` in task desc
      ff21abee
    • Y
      [ci skip] Replace `AR` with `Active Record` in task desc · 5adaa9dc
      yui-knk 提交于
      Many user look `desc` of rake task and they are not familiar with `AR`.
      `Active Record` is more familiar word.
      5adaa9dc
  3. 06 9月, 2015 10 次提交
  4. 05 9月, 2015 7 次提交