_perf
Lightweight Python-side perf instrumentation.
Emits [PERF:py] checkpoints through the standard pyRevit logger at DEBUG level so Python startup-script timings interleave with the C# loader's [PERF] timeline in the regular runtime log / output window.
Self-contained on purpose: imports only stdlib at module load so it can be the first line of pyrevit/init.py without triggering circular loads. The pyRevit logger is resolved lazily on first use; checkpoints that fire before the logger is importable (early bootstrap) are silently skipped.
Classes
time_block(label)
Bases: object
Context manager: time a block independently of the running timeline.
Emits one DEBUG [PERF:py] line at exit, indented two extra spaces past
mark() lines to mirror C# sub-item indentation ([PERF] <name>:).
Source code in pyrevitlib/pyrevit/_perf.py
Attributes
label = label
instance-attribute
Functions
mark(label)
Record a perf checkpoint.
Emits one DEBUG [PERF:py] line with elapsed time since the previous
mark. Format mirrors the C# [PERF] lines for visual parity. No-op until
the pyRevit logger is importable.