ITADN

[FEATURE] Show per-script hook execution time for performance profiling

#3620Closedluginf 创建于 2026-05-23
Type: Feature
L
luginfcommented
#### Is your feature request related to a problem? Please describe. When multiple scripts are installed, it is currently impossible to identify which one is causing slowdowns without disabling them one by one. A lightweight profiling mechanism would make it much easier to diagnose performance issues. #### Describe the solution you'd like Wrap each scripting hook invocation (e.g. noteToMarkdownHtmlHook, handleNoteTextFileNameHook, customActionInvoked, …) with a QElapsedTimer on the C++ side. When execution time exceeds a configurable threshold (or unconditionally in a debug/profiling mode), log a warning such as: > [script profiler] my-script :: noteToMarkdownHtmlHook took 42 ms Optionally, expose an aggregated summary (total time per script per hook) in the script settings panel or in the log window. - noteToMarkdownHtmlHook is called on every keystroke in live preview — even a mildly expensive script causes visible lag. - Users with many scripts installed have no way to pinpoint the offending one without tedious manual bisection. - The change is self-contained: a QElapsedTimer around each existing hook dispatch call, with a threshold guard to avoid log noise. #### Describe alternatives you've considered - A QOwnNotes script cannot profile other scripts: the scripting API exposes no inter-script communication or CPU metrics. - OS-level profiling (perf, valgrind) works but cannot attribute time to individual scripts by name.
关闭于 2026-05-25 6 条评论