-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve method breakpoint performance.
With pending method breakpoints, track all method invocation to track `method_added` and `singleton_method_added`. Of course, this approach slows down the debuggee's performance. This patch tracks all `method_added` and `singleton_method_added` methods and further defined such methods for the classes/modules. This approach doesn't have performance penalty any more. This patch also fix the message at registering the pending method breakpoint. ```ruby binding.b do: 'b C#foo' unless ENV['NO_PENDING_BP'] def fib n if n<2 n else fib(n-1)+fib(n-2) end end require 'benchmark' Benchmark.bm{|x| x.report{ fib(35) } } ``` Results: ``` Without pending breakpoints: $ NO_PENDING_BP=1 exe/rdbg -n target.rb user system total real 0.929580 0.000000 0.929580 ( 0.929682) With pending breakpoints - Before this patch: $ exe/rdbg -n target.rb [1, 10] in target.rb => 1| binding.b do: <<~DBG 2| b C#foo 3| DBG 4| 5| def fib n 6| if n<2 7| n 8| else 9| fib(n-1)+fib(n-2) 10| end =>#0 <main> at target.rb:1 (rdbg:binding.break) b C#foo uninitialized constant C C ^ user system total real 3.276217 0.000000 3.276217 ( 3.276299) With pending breakpoints - After this patch: [master]$ exe/rdbg -n target.rb [1, 10] in target.rb => 1| binding.b do: <<~DBG 2| b C#foo 3| DBG 4| 5| def fib n 6| if n<2 7| n 8| else 9| fib(n-1)+fib(n-2) 10| end =>#0 <main> at target.rb:1 (rdbg:binding.break) b C#foo Unknown name `C` for `Object` user system total real 0.933402 0.002353 0.935755 ( 0.935757) ```
- Loading branch information
Showing
3 changed files
with
48 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters