1. 20 11月, 2015 5 次提交
    • R
      Fix test failure in `adapters/mysql/active_schema_test.rb` · 056d6c34
      Ryuta Kamizono 提交于
      Follow up to #21601.
      056d6c34
    • S
      Revert "Allow specifying the default table options for mysql adapters" · 6b7861e8
      Sean Griffin 提交于
      This reverts commit 8246b593.
      
      There was concern about this modifying the behavior of past migrations.
      We're going to add an way to modify the migration generator instead.
      6b7861e8
    • S
      Allow specifying the default table options for mysql adapters · 8246b593
      Sean Griffin 提交于
      It's often the case that you want to have an option that you cannot
      specify at the database level, but want applied to *all* tables that you
      create. For example, you might want to specify `ROW_FORMAT=DYNAMIC` to
      not have to limit text columns to length 171 for indexing when using
      utf8mb4. This allows an easy way to specify this in your database
      configuration.
      
      While this change affects both MySQL and MySQL2, the test only covers
      MySQL2, as the legacy mysql adapter appears to always return ASCII
      strings, and is tangential to what we're actually doing.
      8246b593
    • K
      Merge pull request #22336 from tjschuck/enumerable_sum_perf · 7e200f29
      Kasper Timm Hansen 提交于
      Change Enumerable#sum to use inject(:sym) specification
      7e200f29
    • T
      Change Enumerable#sum to use inject(:sym) specification · c703c39a
      T.J. Schuck 提交于
      Not only does this make for simpler, more obvious code, it's also more performant:
      
          require 'benchmark/ips'
      
          module Enumerable
            def old_sum(identity = 0, &block)
              if block_given?
                map(&block).old_sum(identity)
              else
                inject { |sum, element| sum + element } || identity
              end
            end
      
            def new_sum(identity = 0, &block)
              if block_given?
                map(&block).new_sum(identity)
              else
                inject(:+) || identity
              end
            end
          end
      
          summable = (1..100).to_a # sum is 5050
      
          Benchmark.ips do |x|
            x.report("old_sum") { summable.old_sum }
            x.report("new_sum") { summable.new_sum }
            x.compare!
          end
      
          # Calculating -------------------------------------
          #              old_sum    10.674k i/100ms
          #              new_sum    14.542k i/100ms
          # -------------------------------------------------
          #              old_sum    117.350k (± 7.1%) i/s -    587.070k
          #              new_sum    154.712k (± 3.8%) i/s -    785.268k
          #
          # Comparison:
          #              new_sum:   154712.1 i/s
          #              old_sum:   117350.0 i/s - 1.32x slower
      
      More benchmarks [here](https://gist.github.com/tjschuck/b3fe4e8c812712376648), including summing strings and passing blocks.  The performance gains are less for those, but this version still always wins.
      c703c39a
  2. 19 11月, 2015 10 次提交
  3. 18 11月, 2015 8 次提交
  4. 17 11月, 2015 10 次提交
  5. 16 11月, 2015 7 次提交