From 53fa78c01f2618d391773f294e1ba0e3f01b92fd Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 18 May 2023 19:43:44 +0200 Subject: [PATCH] Ruby debugger performance boost Problem was that the file-to-id cache was cleared upon calling internal Ruby functions (begin_exec was triggered). In one test case, the execution performance improved from 6s/320s (without/with debugger) to 6s/7s (without/with debugger) --- src/pya/pya/pya.cc | 8 +++++--- src/rba/rba/rba.cc | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pya/pya/pya.cc b/src/pya/pya/pya.cc index 39a400f2c..53d0d9496 100644 --- a/src/pya/pya/pya.cc +++ b/src/pya/pya/pya.cc @@ -888,10 +888,12 @@ gsi::Console *PythonInterpreter::current_console () const void PythonInterpreter::begin_execution () { - m_file_id_map.clear (); m_block_exceptions = false; - if (m_current_exec_level++ == 0 && mp_current_exec_handler) { - mp_current_exec_handler->start_exec (this); + if (m_current_exec_level++ == 0) { + m_file_id_map.clear (); + if (mp_current_exec_handler) { + mp_current_exec_handler->start_exec (this); + } } } diff --git a/src/rba/rba/rba.cc b/src/rba/rba/rba.cc index b3327b218..27af10ed0 100644 --- a/src/rba/rba/rba.cc +++ b/src/rba/rba/rba.cc @@ -2486,9 +2486,11 @@ RubyInterpreter::begin_exec () { d->exit_on_next = false; d->block_exceptions = false; - d->file_id_map.clear (); - if (d->current_exec_level++ == 0 && d->current_exec_handler) { - d->current_exec_handler->start_exec (this); + if (d->current_exec_level++ == 0) { + d->file_id_map.clear (); + if (d->current_exec_handler) { + d->current_exec_handler->start_exec (this); + } } }