Add comprehensive timing logs across all critical paths

Logs with perf_counter timing on: file load/save, DB sync, all
render functions, save & snap (with deepcopy/save/sync breakdown),
graphviz cache hit/miss, node restore, and API endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 23:53:30 +01:00
parent 1386043f69
commit ecb5cdc13f
5 changed files with 69 additions and 3 deletions
+13
View File
@@ -200,6 +200,9 @@ def index():
@ui.refreshable
def render_main_content():
import time as _time
_t0 = _time.perf_counter()
logger.info("render_main_content START")
max_w = '2400px' if dual_pane['active'] else '1200px'
with ui.column().classes('w-full q-pa-md').style(f'max-width: {max_w}; margin: 0 auto'):
if not state.file_path or not state.file_path.exists():
@@ -230,6 +233,8 @@ def index():
with ui.expansion('ComfyUI Monitor', icon='dns').classes('w-full'):
render_comfy_monitor(state)
logger.info("render_main_content END (%.3fs)", _time.perf_counter() - _t0)
@ui.refreshable
def _render_batch_tab_content():
def on_toggle(e):
@@ -274,6 +279,9 @@ def index():
async def on_select(e):
if not e.value:
return
import time as _time
_t0 = _time.perf_counter()
logger.info("on_select START: %s", e.value)
fp = pane_state.current_dir / e.value
data, mtime = await asyncio.to_thread(load_json, fp)
pane_state.data_cache = data
@@ -282,6 +290,7 @@ def index():
pane_state.file_path = fp
pane_state.restored_indicator = None
_render_batch_tab_content.refresh()
logger.info("on_select END (%.3fs)", _time.perf_counter() - _t0)
ui.select(
file_names,
@@ -292,6 +301,9 @@ def index():
async def load_file(file_name: str):
"""Load a JSON file and refresh the main content."""
import time as _time
_t0 = _time.perf_counter()
logger.info("load_file START: %s", file_name)
fp = state.current_dir / file_name
if state.loaded_file == str(fp):
return
@@ -303,6 +315,7 @@ def index():
state.restored_indicator = None
if state._main_rendered:
render_main_content.refresh()
logger.info("load_file END (%.3fs)", _time.perf_counter() - _t0)
# Attach helpers to state so sidebar can call them
state._load_file = load_file