[ruby-cvs:58957] zzak:r51806 (trunk): * lib/delegate.rb: Remove backtrace cleaning for delegated methods

zzak at ruby-lang.org zzak at ruby-lang.org
Wed Sep 9 11:12:52 JST 2015


zzak	2015-09-09 11:12:52 +0900 (Wed, 09 Sep 2015)

  New Revision: 51806

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51806

  Log:
    * lib/delegate.rb: Remove backtrace cleaning for delegated methods
      This patch was provided by Rafael Fran?\195?\167a and greatly improves
      performance when an exception is raised. [Bug #11461]
    
      Before:
        Calculating -------------------------------------
                 default    86.209k i/100ms
         default raising     2.209k i/100ms
        -------------------------------------------------
                 default      1.953M (?\194?\17711.0%) i/s -      9.655M
         default raising     21.826k (?\194?\17713.5%) i/s -    108.241k
    
      After:
        Calculating -------------------------------------
                 default    72.211k i/100ms
         default raising    34.288k i/100ms
        -------------------------------------------------
                 default      2.013M (?\194?\17718.7%) i/s -      9.460M
         default raising    623.950k (?\194?\177 9.7%) i/s -      3.120M
    
      Benchmark:
        require 'delegate'
        require 'benchmark/ips'
    
        class Foo
          def name
            'foo'
          end
    
          def bla
            raise
          end
        end
    
        class Bar < DelegateClass(Foo)
        end
    
        bar = Bar.new(Foo.new)
    
        Benchmark.ips do |b|
          b.report('default') { bar.name }
          b.report('default raising') { bar.bla rescue nil }
        end

  Modified files:
    trunk/ChangeLog
    trunk/lib/delegate.rb


More information about the ruby-cvs mailing list