Skip to content

citry check's Vue compile grows faster than template depth #501

Closed

Description

@JuroOravec

What happens

citry check compiles each component's template with the Vue compiler to report Vue's own errors (_compile in packages/py/citry/citry/_vue_compile_lint.py:308, which calls _rust.vue._compile_vue). On deeply nested templates that compile grows faster than the depth: about 3 times as long each time the depth doubles.

Measured with cProfile on CPython 3.14.9, a debug build of citry_core, one component checked with check_project:

Template, repeated depth times Depths _compile_vue time Ratio
<div> 256 → 512 0.070 s → 0.212 s 3.0
<c-if cond="not flag">no</c-if><c-elif cond="flag"> ... </c-elif><c-else>else</c-else> 128 → 256 0.150 s → 0.493 s 3.3

After #384 (perf/shared-ast-children), the rest of the check grows close to linearly, so this compile is now most of the check's time on these templates: about half at 256 levels. The times are still well under a second at the nesting limits, so nobody hits this as a slow check today. This issue records where the remaining growth is.

A smaller cost grows with the square of the depth too: line_break_count (packages/py/citry/citry/_source_lines.py:30) is called once per node, 1,024 times for the c-elif template at 256 levels, and took 0.027 s there.

Fix direction

Profile _compile_vue on these templates in a release build, find the pass whose cost grows faster than the depth, and make it linear. The compiler's output must not change; the Vue compile-lint tests cover that. If the release build already grows linearly, close this issue.

Activity

  1. JuroOravec commented on Oct 28, 2026

    @JuroOravec
    MemberAuthor

    The checker's line lookup and the step-by-step site-id hashing landed in #538. The remaining two changes are tracked as v1.1 issues: #537 (parent indices in the compiler output) and #536 (cap the indentation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions