parse_lines: keep values as list of lines, join once - #78
RonnyPfannschmidt merged 1 commit into
Conversation
982e0b4 to
6cac8b1
Compare
Each continuation line rebuilt the whole accumulated value string, which is quadratic in the number of continuation lines of a value. ParsedLine.value is now the list of value lines; continuations append to it and parse_ini_data joins it once. Alternative to pytest-dev#77 with a smaller change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yrarEe7i67yuTE8GC22ey
6cac8b1 to
eb8b24f
Compare
Speed comparison
Both PRs remove the quadratic cost, and their speed is the same within noise. At realistic config sizes (a few hundred lines in total, values with at most ~100 continuation lines) the gain is tens to hundreds of microseconds. This is cleanup, not a user-visible performance fix. Chosen tradeoff#77 keeps #78 makes
As a result the parser gets shorter than it is on main (+6/−13 in Cost: Verification
Analysis, implementation and benchmarks done with Claude Code, and reviewed by me. |
Each continuation line rebuilt the whole accumulated value string, which is quadratic in the number of continuation lines of a value. ParsedLine.value is now the list of value lines; continuations append to it and parse_ini_data joins it once.
Alternative to #77 with a smaller change.
Claude-Session: https://claude.ai/code/session_012yrarEe7i67yuTE8GC22ey