1. 24 3月, 2018 1 次提交
  2. 23 3月, 2018 6 次提交
  3. 22 3月, 2018 10 次提交
  4. 21 3月, 2018 4 次提交
  5. 20 3月, 2018 10 次提交
    • R
      fab6ded8
    • A
      Merge pull request #32305 from q-centrix/perf-improvement-translation-helper · 09656deb
      Andrew White 提交于
      Memoize the result of gsubbing @virtual_path
      09656deb
    • D
      Memoize the result of gsubbing @virtual_path · 05eaa076
      Dillon Welch 提交于
      This gets called many times for each virtual_path, creating a new string
      each time that `translate` is called. We can memoize this so that it
      only happens once per virtual_path instead.
      05eaa076
    • A
      Merge pull request #32302 from q-centrix/perf-improvement-tag-name · c7cbc2e3
      Andrew White 提交于
      Interpolate '' instead of nil when multiple is false.
      c7cbc2e3
    • D
      Interpolate '' instead of nil when multiple is false. · 8e095d69
      Dillon Welch 提交于
      "my string #{nil}" results in an additional '' string allocation, I'm
      guessing because the nil has to be converted to a string.
      
      "my string #{'[]' if multiple}" results in "my string #{nil}" if
      multiple is false. Doing "my string #{''}" does not result in an extra
      string allocation. I moved the if multiple logic into a method so I only
      had to make the change once.
      
      ```ruby
      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 "benchmark-ips"
        gem "rails"
      end
      
      def allocate_count
        GC.disable
        before = ObjectSpace.count_objects
        yield
        after = ObjectSpace.count_objects
        after.each { |k,v| after[k] = v - before[k] }
        after[:T_HASH] -= 1 # probe effect - we created the before hash.
        GC.enable
        result = after.reject { |k,v| v == 0 }
        GC.start
        result
      end
      
      @html_options = {}
      
      def master_version(multiple=nil)
        "hi#{"[]" if multiple}"
      end
      
      def fast_version(multiple=nil)
        str = multiple ? "[]" : ''
        "hi#{str}"
      end
      
      def test
        puts "master_version"
        puts allocate_count { 1000.times { master_version } }
        puts "master_version with arg"
        puts allocate_count { 1000.times { master_version(' there') } }
        puts "fast_version"
        puts allocate_count { 1000.times { fast_version } }
        puts "fast_version with arg"
        puts allocate_count { 1000.times { fast_version(' there') } }
      
        Benchmark.ips do |x|
          x.report("master_version") { master_version }
          x.report("master_version with arg") { master_version(' there') }
          x.report("fast_version")     { fast_version }
          x.report("fast_version with arg")     { fast_version(' there') }
          x.compare!
        end
      end
      
      test
      ```
      
      results:
      ```ruby
      master_version
      {:FREE=>-1981, :T_STRING=>2052}
      master_version with arg
      {:FREE=>-1001, :T_STRING=>1000}
      fast_version
      {:FREE=>-1001, :T_STRING=>1000}
      fast_version with arg
      {:FREE=>-1001, :T_STRING=>1000}
      Warming up --------------------------------------
            master_version   138.851k i/100ms
      master_version with arg
                             164.029k i/100ms
              fast_version   165.737k i/100ms
      fast_version with arg
                             167.016k i/100ms
      Calculating -------------------------------------
            master_version      2.464M (±14.7%) i/s -     11.941M in   5.023307s
      master_version with arg
                                3.754M (± 8.5%) i/s -     18.699M in   5.021354s
              fast_version      3.449M (±11.7%) i/s -     17.071M in   5.033312s
      fast_version with arg
                                3.636M (± 6.9%) i/s -     18.205M in   5.034792s
      
      Comparison:
      master_version with arg:  3753896.1 i/s
      fast_version with arg:  3636094.5 i/s - same-ish: difference falls within error
              fast_version:  3448766.2 i/s - same-ish: difference falls within error
            master_version:  2463857.3 i/s - 1.52x  slower
      ```
      8e095d69
    • J
      Merge pull request #32282 from javan/fix-digesting-mixed-formats · 7f71a6a6
      Javan Makhmali 提交于
      Fix digesting templates with mixed formats
      7f71a6a6
    • J
      Fix digesting templates with mixed formats · f4eb2e23
      Javan Makhmali 提交于
      f4eb2e23
    • R
      Merge pull request #32300 from albertoalmagro/albertoalmagro/remove-outdated-todo · 9d9f7526
      Rafael França 提交于
      ActiveJob: Remove support for Qu gem.
      9d9f7526
    • A
      Remove support for Qu gem. · 6ef72079
      Alberto Almagro 提交于
      Reasons are that the Qu gem wasn't compatible since Rails 5.1,
      gem development was stopped in 2014 and maintainers have
      confirmed its demise. See issue #32273
      6ef72079
    • J
  6. 19 3月, 2018 9 次提交