-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip check for pending breakpoints if no breakpoints are present #738
Conversation
The |
Gotcha, I tried this out locally but I wasn't able to see that behavior. For versions prior to 3.1, SourceRepository#add does store file lines, but skipping that appears to not be an issue either, as SourceRepository#get will fall back to adding them at retrieval time if they're not already stored. Does that seem right? Apologies if I am missing something! |
@WillHalto Yes I think you get it right. I missed the fallback mechanism. |
@st0012 thanks for the feedback! Based on that ^, does the approach in 949562d seem alright? Alternatively, if we do want to preserve the calls to
which I don't believe is necessary. Perhaps we could instead try: @tp_load_script = TracePoint.new(:script_compiled){|tp|
- ThreadClient.current.on_load tp.instruction_sequence, tp.eval_script
+ on_load tp.instruction_sequence, tp.eval_script
} and skip the event queue. This works well in my tests and gives a similar (+/- ~100ms) performance improvement as the current proposed approach in the PR. Just something else to consider 👍 Before:
After change in 949562d
Directly calling on_load, skipping event queue: time bundle exec ruby file_1.rb
real 0m0.998s
user 0m0.665s
sys 0m0.332s |
Thank you for the idea.
So I think we can skip it on Ruby 3.1 and later. Do you modify this PR? |
949562d
to
0e12fa1
Compare
Thank you. |
Description
Describe your changes:
ThreadClient.current.on_load
spend time pushing and popping the :load operation on the event queue, and waiting for the :load event to be handled.require "debug"
, event when there are no breakpoints set at all. This seems to be at odd's with the README's "Fast: No performance penalty on non-stepping mode and non-breakpoints."ThreadClient.current.on_load
when there are no breakpoints present at all, we can save some of this time.ThreadClient.current.on_load
is to handle any pending breakpoints in the loaded code, which we can safely skip if@bps
is empty.Example:
file_1.rb:
file_2.rb:
Before 949562d:
After 949562d:
^ It's a significant improvement in the overhead when using
require "debug"