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)
This commit is contained in:
Matthias Koefferlein 2023-05-18 19:43:44 +02:00
parent ba0aaef132
commit 53fa78c01f
2 changed files with 10 additions and 6 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}