From 8f25c3470d0da5abcdceb8ec14876dc67dbb3e3e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 14 May 2023 18:33:53 +0200 Subject: [PATCH 1/2] Small enhancement to 'decompose_convex' with the goal to avoid thin slivers --- src/db/db/dbPolygonTools.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbPolygonTools.cc b/src/db/db/dbPolygonTools.cc index db18b69d3..ca1f077ea 100644 --- a/src/db/db/dbPolygonTools.cc +++ b/src/db/db/dbPolygonTools.cc @@ -2300,9 +2300,11 @@ static void decompose_convex_helper (int depth, PreferredOrientation po, const d db::Box bbox = sp.box (); db::coord_traits::area_type atot = 0; + db::coord_traits::distance_type min_edge = std::numeric_limits::distance_type>::max (); for (size_t i = 0; i < n; ++i) { db::Edge ep (sp.hull ()[(i + n - 1) % n], sp.hull ()[i]); atot += db::vprod (ep.p2 () - db::Point (), ep.p1 () - db::Point ()); + min_edge = std::min (min_edge, ep.length ()); } std::set skipped; @@ -2449,9 +2451,14 @@ static void decompose_convex_helper (int depth, PreferredOrientation po, const d int cr = 0; if (x.second == efc.p1 ()) { if (db::vprod (efc, efp) < 0) { - cr = 2; // cut terminates at another concave corner + cr = 3; // cut terminates at another concave corner } else { - cr = 1; // cut terminates at a convex corner + cr = 2; // cut terminates at a convex corner + } + } else { + db::coord_traits::distance_type el = std::min (x.second.distance (efc.p1 ()), x.second.distance (efc.p2 ())); + if (el >= min_edge) { + cr = 1; // does not induce shorter edge than we have so far } } From 53fa78c01f2618d391773f294e1ba0e3f01b92fd Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 18 May 2023 19:43:44 +0200 Subject: [PATCH 2/2] 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); + } } }