Classes
ParseAccumulator
7
▼
Accumulated metrics during Markdown parsing.
Opt-in profiling for debugging slow parsing.
Zero ove…
ParseAccumulator
7
▼
Accumulated metrics during Markdown parsing.
Opt-in profiling for debugging slow parsing. Zero overhead when disabled (get_parse_accumulator() returns None).
Attributes
| Name | Type | Description |
|---|---|---|
start_time |
float
|
Parse start timestamp. |
source_length |
int
|
Length of source being parsed. |
node_count |
int
|
Number of AST nodes produced. |
parse_calls |
int
|
Number of parse() calls recorded. |
Methods
total_duration_ms
0
float
▼
Total profiling duration in milliseconds.
property
total_duration_ms
0
float
▼
def total_duration_ms(self) -> float
Returns
float
record_parse
2
▼
Record a parse call.
record_parse
2
▼
def record_parse(self, source_length: int, node_count: int) -> None
Parameters
| Name | Type | Description |
|---|---|---|
source_length |
— |
Length of the source string parsed. |
node_count |
— |
Number of AST nodes in the result. |
summary
0
dict[str, Any]
▼
Get summary of parse metrics.
summary
0
dict[str, Any]
▼
def summary(self) -> dict[str, Any]
Returns
dict[str, Any]
Dict with total_ms, source_length, node_count, parse_calls.
Functions
get_parse_accumulator
0
ParseAccumulator | None
▼
Get current accumulator (None if profiling disabled).
get_parse_accumulator
0
ParseAccumulator | None
▼
def get_parse_accumulator() -> ParseAccumulator | None
Returns
ParseAccumulator | None
profiled_parse
0
Iterator[ParseAccumulato…
▼
Context manager for profiled parsing.
Creates a ParseAccumulator and makes it …
profiled_parse
0
Iterator[ParseAccumulato…
▼
def profiled_parse() -> Iterator[ParseAccumulator]
Context manager for profiled parsing.
Creates a ParseAccumulator and makes it available via get_parse_accumulator() for the duration of the with block.
Returns
Iterator[ParseAccumulator]