Startup-Diagnose: Imports + Display-Modes + Window-Layout messen

Bisher: Wall-time 3.2s vs gemessene Arbeit 0.9s → 2.3s unmeasured.
Jetzt werden auch die bisher blinden Stellen getrackt:

- 9× Modul-Import (rhinopanel, oberleiste, ausschnitte, ...) als
  phase="import", label=mod_id
- oberleiste display-mode-Ensure-Loop (4× DisplayModeDescription-Calls)
  als phase="display_modes"
- _apply_window_layout RunScript-Sequenz als phase="window_layout"
- text_editor doppelklick-Hook + view-modes assign + unit-check als
  post_init/hook Phases

Nach Reload sollte das Summary zeigen wo die 2.3s versickern → daraus
gezielte Optimierungen.
This commit is contained in:
2026-05-27 19:08:02 +02:00
parent 61923e1b2b
commit 6fee7bd143
2 changed files with 26 additions and 0 deletions
+15
View File
@@ -768,7 +768,17 @@ def _apply_window_layout(name):
if not name:
print("[OBERLEISTE] apply_window_layout: leerer Name")
return False
import time as _t_wl
_t_wl_start = _t_wl.time()
try:
_ret = _apply_window_layout_impl(name)
finally:
try: panel_base._t_mark("window_layout", name, _t_wl_start)
except Exception: pass
return _ret
def _apply_window_layout_impl(name):
guid = _layout_name_to_guid(name)
print("[OBERLEISTE] apply_window_layout: name='{}' guid='{}'".format(
name, guid))
@@ -2134,11 +2144,16 @@ def _bridge_factory():
# bei jedem startup.py oder _reset_panels.py, unabhaengig davon ob das
# Panel jemals geoeffnet wird. Funktion ist idempotent.
# Alle Dossier-Display-Modes registrieren (Plan, 3D, ...)
import time as _t_dm
_t_dm_start = _t_dm.time()
for _name, _guid, _tmpl, _fallback in _DOSSIER_DISPLAY_MODES:
try:
_ensure_dossier_display_mode(_name, _guid, _tmpl, _fallback)
except Exception as _ex:
print("[OBERLEISTE] ensure {}: {}".format(_name, _ex))
try:
panel_base._t_mark("display_modes", "oberleiste", _t_dm_start)
except Exception: pass
panel_base.register_and_open("oberleiste", "Oberleiste", PANEL_GUID_STR, _bridge_factory,
+11
View File
@@ -263,28 +263,39 @@ def _load_all(sender, e):
print("[STARTUP] Keine dossier.project.json — alle Module laden")
# massstab.py wird als Library mitgeladen (von oberleiste/ausschnitte/...)
# und braucht hier nicht mehr als eigenstaendiges Panel zu erscheinen.
# Imports messen — das ist der grosse Block der bisher unmeasured war
import time as _t
import panel_base as _pb
for mod_id in enabled_ids:
py_name = _MODULE_TO_PY[mod_id]
_t_imp = _t.time()
try:
__import__(py_name)
_pb._t_mark("import", mod_id, _t_imp)
print("[STARTUP] {} ({}) OK".format(mod_id, py_name))
except Exception as ex:
print("[STARTUP] {} ({}) FEHLER: {}".format(mod_id, py_name, ex))
# Text-Editor Doppelklick-Hook fuer DOSSIER-Texte
_t_te = _t.time()
try:
import text_editor
text_editor._ensure_double_click_hook()
_pb._t_mark("hook", "text_editor", _t_te)
except Exception as ex:
print("[STARTUP] text_editor hook:", ex)
# Display-Modes auf Default fuer aktives Doc setzen (einmalig)
_t_vm = _t.time()
try:
_assign_default_display_modes(Rhino.RhinoDoc.ActiveDoc)
_pb._t_mark("post_init", "view_modes", _t_vm)
except Exception as ex:
print("[STARTUP] view-modes assign:", ex)
# Unit-Check fuer das beim Start aktive Doc — fragt einmal pro Doc
# wenn doc.ModelUnitSystem != Project-Setting
_t_uc = _t.time()
try:
_check_doc_unit(Rhino.RhinoDoc.ActiveDoc)
_pb._t_mark("post_init", "unit_check", _t_uc)
except Exception as ex:
print("[STARTUP] unit-check active doc:", ex)
# DOSSIERUI Window-Layout — Hinweis fuer manuelles Laden