Issue #10511 has been updated by Dennis Ushakov.


I was not able to achieve 4x on a simple benchmark, but the difference is quite big:
`
require 'benchmark'

N = 10000
RECURSION = 1000

def recurse(i)
	recurse(i - 1) if i > 0
end

TracePoint.new(:call, :return, :c_call, :c_return, :line){|tp|
	tp.lineno
}.enable


puts Benchmark.measure { N.times { recurse(RECURSION) } }
`
Results are:
~~~
2.1.2 - 14.000000   0.070000  14.070000 ( 14.640882)
2.1.5 - 16.980000   0.030000  17.010000 ( 17.294063)
~~~

Results without tracepoint:
~~~
2.1.2 - 0.810000   0.000000   0.810000 (  0.890800)
2.1.5 - 0.830000   0.000000   0.830000 (  0.855288)
~~~
(almost no difference between versions)

----------------------------------------
Bug #10511: fix for #9940 causes dramatic performance regression
https://bugs.ruby-lang.org/issues/10511#change-49990

* Author: Oleg Sukhodolsky
* Status: Open
* Priority: Normal
* Assignee: 
* Category: core
* Target version: 
* ruby -v: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Originally reported against debase gem (https://github.com/denofevil/debase/issues/16)
After fix for #9940 running anything under debugger became about 4 times slower.
I've verified that we I revert the fix performance is restored.
To reproduce you could get https://github.com/railstutorial/sample_app_rails_4 and run rspec rake task under debugger (I've used RubyMine for this because debase is used as 
debugger's backend there)
Performance with 2.1.2 it takes about 20 seconds on my laptop, with 2.1.3 - almost 80 seconds :(
The same problem is observable with 2.1.4 and 2.1.5 too.




-- 
https://bugs.ruby-lang.org/