Permalink
Switch branches/tags
Commits on Sep 25, 2018
  1. Fix a content_for test description

    JuanitoFatas committed Sep 25, 2018
Commits on Jan 22, 2016
  1. Remove action_cable_meta_tag when skip action_cable

    JuanitoFatas committed Jan 22, 2016
Commits on Nov 12, 2015
  1. Fix instance variable not defined warning from Active Support test suite

    JuanitoFatas committed Nov 12, 2015
    Before
    
    ./Users/Juan/dev/rails/activesupport/test/file_update_checker_shared_tests.rb:20: warning: instance variable @tmpdir not initialized
    
    After
    
    No warnings
Commits on Sep 24, 2015
Commits on Sep 22, 2015
Commits on Sep 15, 2015
  1. Use rack.session_options instead of directly change env

    JuanitoFatas committed Sep 15, 2015
Commits on Sep 12, 2015
  1. Improve String#strip_heredoc

    JuanitoFatas committed Sep 12, 2015
    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.
    ```
Commits on Sep 5, 2015
Commits on Jul 23, 2015
  1. Don't fail when checking dependencies in bin/setup script

    JuanitoFatas committed Jul 23, 2015
Commits on Mar 26, 2015
  1. Add missing :html option in determine_template error message.

    JuanitoFatas committed Mar 26, 2015
Commits on Mar 24, 2015
  1. Rails 5 requires 2.2.1. [ci skip]

    JuanitoFatas committed Mar 24, 2015
    Follow up of #19263.
Commits on Mar 17, 2015
  1. Remove unused variable in activerecord reflection_test.

    JuanitoFatas committed Mar 17, 2015
Commits on Mar 3, 2015
  1. Add more documents for AR connection_adapters abstract schema_definit…

    JuanitoFatas committed Mar 2, 2015
    …ions. [ci skip]
    
    - Add example to column_exists?
    - Add example to index_exists?
    - Add document for foreign_key
    - Add document for foreign_key_exists?
Commits on Mar 2, 2015
  1. Use include? instead of in? for Enumerable#without.

    JuanitoFatas committed Mar 2, 2015
    [egilburg]
  2. Include object inclusion for enumerable test.

    JuanitoFatas committed Mar 2, 2015
Commits on Feb 10, 2015
Commits on Jan 31, 2015
  1. Fix a typo in deprecation warning. #process takes method instead of h…

    JuanitoFatas committed Jan 31, 2015
    …ttp_method.
Commits on Jan 29, 2015
Commits on Jan 2, 2015
Commits on Dec 16, 2014
Commits on Oct 25, 2014
Commits on Sep 16, 2014
Commits on Sep 7, 2014
  1. [ci skip] Fix some typos, normalize sentence.

    JuanitoFatas committed Sep 7, 2014
    Follow up of #16722.
    
    #16722
    
    also normalize all instance gained methods’ sentence.
Commits on Aug 24, 2014
  1. Fix guide anchor generation logic.

    JuanitoFatas committed Aug 24, 2014
    This could use in any translation because it's not limited to `[^a-z0-9]`.
    
    Verify after this change, all guides still have same anchors.
    
    [Robin Dupret & Juanito Fatas]
Commits on Aug 20, 2014
  1. Revert "Do not gsub non ASCII characters in header anchor.".

    JuanitoFatas committed Aug 20, 2014
    This reverts commit 699babe.
    
    Also change the upgrading_ruby_on_rails link back to original in 4_2_release_notes.
Commits on Aug 16, 2014
Commits on Jul 20, 2014
Commits on Jul 16, 2014