1. 16 9月, 2015 6 次提交
  2. 15 9月, 2015 15 次提交
  3. 14 9月, 2015 5 次提交
    • C
      Merge pull request #21619 from kamipo/fix_doc_of_text_limit · 89e61f01
      Claudio B. 提交于
      Fix doc of limit option for a text column [ci skip]
      89e61f01
    • R
      Fix doc of limit option for a text column [ci skip] · e463f6cc
      Ryuta Kamizono 提交于
      Follow up #21591.
      
      The document of limit option for a text column is incorrect.
      
      MySQL: the limit is byte length, not character length
      Pg, Sqlite3: variable unlimited length
      e463f6cc
    • C
      Merge pull request #21617 from lunks/patch-1 · 174a57e1
      Claudio B. 提交于
      Fix HSTS default expire in ActionDispatch::SSL docs.
      174a57e1
    • P
      7c471600
    • C
      Remove AS methods that are never invoked · 45ccc462
      claudiob 提交于
      Fixes #21122 - does not change any current behavior; simply reflects
      the fact that two conditions of the if/else statement are never reached.
      
      The reason is #17227 which adds a default terminator to AS::Callbacks.
      
      Therefore, even callback chains that do not define a terminator now
      have a terminator, and `chain_config.key?(:terminator)` is always true.
      
      Of course, if no terminator was defined, then we want this new default
      terminator not to do anything special. What the terminator actually does
      (or should do) is discussed in #21218 but the simple fact that a default
      terminator exists makes this current PR valid.
      
      *Note* that the conditional/simple methods have not been removed in
      AS::Conditionals::Filter::After because of `:skip_after_callbacks_if_terminated`
      which lets a user decide **not** to skip after callbacks even if the chain was
      terminated.
      45ccc462
  4. 13 9月, 2015 9 次提交
  5. 12 9月, 2015 3 次提交
    • E
      Ruby 2.2.3 in windows need nokogiri 1.6.7.rc3 as it's the only version having... · bbfd1768
      Eric Guo 提交于
      Ruby 2.2.3 in windows need nokogiri 1.6.7.rc3 as it's the only version having correct pre-compiled so
      bbfd1768
    • X
      Merge pull request #21596 from JuanitoFatas/perf/strip-heredoc · 59ec70dc
      Xavier Noria 提交于
      Improve String#strip_heredoc
      59ec70dc
    • J
      Improve String#strip_heredoc · 503d3345
      Juanito Fatas 提交于
      Saves about 6 MB, about 40% faster.
      
      **strip_heredoc.rb**
      
      ```ruby
      require "active_support/core_ext/object/try"
      require "get_process_mem"
      
      class String
        def strip_heredoc
          indent = scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
          gsub(/^[ \t]{#{indent}}/, '')
        end
      end
      
      if ENV["MEASURE_MEMORY"] == "yes"
        mem = GetProcessMem.new
        GC.start
        GC.disable
        10000.times do
          <<-MSG.strip_heredoc
            xhr and xml_http_request methods are deprecated in favor of
            `get :index, xhr: true` and `post :create, xhr: true`
          MSG
        end
        before = mem.mb
      
        after = mem.mb
        GC.enable
        puts "Before: #{before} MiB"
        puts "After: #{after} MiB"
        puts "Diff: #{after - before} MiB"
      end
      ```
      
      **patched_strip_heredoc.rb**
      
      ```ruby
      require "active_support/core_ext/object/try"
      require "get_process_mem"
      
      class String
        def patched_strip_heredoc
          gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "".freeze)
        end
      end
      
      if ENV["MEASURE_MEMORY"] == "yes"
        mem = GetProcessMem.new
        GC.start
        GC.disable
        10000.times do
          <<-MSG.patched_strip_heredoc
            xhr and xml_http_request methods are deprecated in favor of
            `get :index, xhr: true` and `post :create, xhr: true`
          MSG
        end
        before = mem.mb
      
        after = mem.mb
        GC.enable
        puts "Before: #{before} MiB"
        puts "After: #{after} MiB"
        puts "Diff: #{after - before} MiB"
      end
      ```
      
      **Before**
      
      ```
      $ MEASURE_MEMORY=yes ruby strip_heredoc.rb
      Before: 44.73828125 MiB
      After: 44.7734375 MiB
      Diff: 0.03515625 MiB
      ```
      
      **After**
      
      ```
      $ MEASURE_MEMORY=yes ruby patched_strip_heredoc.rb
      Before: 37.9765625 MiB
      After: 38.015625 MiB
      Diff: 0.0390625 MiB
      ```
      
      `44.7734375 -  38.015625 = 6.75`
      
      => **Saves about 6.75 MiB**
      
      **benchmark.rb**
      
      ```ruby
      require "benchmark/ips"
      require_relative "./strip_heredoc"
      require_relative "./patched_strip_heredoc"
      
      def original
        <<-MSG.strip_heredoc
          xhr and xml_http_request methods are deprecated in favor of
          `get :index, xhr: true` and `post :create, xhr: true`
        MSG
      end
      
      def patched
        <<-MSG.patched_strip_heredoc
          xhr and xml_http_request methods are deprecated in favor of
          `get :index, xhr: true` and `post :create, xhr: true`
        MSG
      end
      
      Benchmark.ips do |x|
        x.report("original") { original }
        x.report(" patched") { patched  }
        x.compare!
      end
      ```
      
      ```
      $ ruby -v benchmark.rb
      ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
      Calculating -------------------------------------
                  original     5.652k i/100ms
                   patched     6.477k i/100ms
      -------------------------------------------------
                  original     54.076k (± 5.7%) i/s -    271.296k
                   patched     74.557k (± 6.2%) i/s -    375.666k
      
      Comparison:
                   patched:    74557.0 i/s
                  original:    54076.4 i/s - 1.38x slower
      ```
      
      => **About 38% faster**
      
      1. Clone rails project `git clone git@github.com:rails/rails.git`
      2. Apply this patch to
      `activesupport/lib/active_support/core_ext/string/strip.rb`
      3. `cd activesupport`
      4. run `rake`
      5. And tests passed:
      
      ```
      ➜ activesupport $ rake
      /Users/Juan/.rubies/ruby-2.2.2/bin/ruby -w -I"lib:test"
      "/Users/Juan/.rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb"
       "test/**/*_test.rb"
      
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ........................................................................
      ......................................................................S.
      SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
      
      Finished in 15.343004s, 214.2344 runs/s, 24902.4898 assertions/s.
      
      3287 runs, 382079 assertions, 0 failures, 0 errors, 48 skips
      
      You have skipped tests. Run with --verbose for details.
      ```
      503d3345
  6. 11 9月, 2015 2 次提交