Skip to content

Recompiling a page has no speed budget in tests/perf #459

Done

Description

@Espoir-Loem

What happens

Nexy promises "Sub-100ms HMR" (AGENTS.md), and AGENTS.md also says a hot path gets a speed budget in tests/perf/. Recompiling a page after an edit is the Python half of every reload in nx dev, and it has no budget:

  • tests/perf/ holds test_startup_budget.py (a new process is ready in under a second) and test_request_budget.py (a request costs at most a few times bare Starlette);
  • the recompile time is only published (1.8 ms, docs/deployment/performance.md#startup-first-page-and-recompile), never enforced. A change that makes it 100 times slower passes every test.

Proposal

Add tests/perf/test_recompile_budget.py:

  • a project with one page that imports three components, like the README example;
  • compile the page once to warm up, then edit it and compile it again, 5 times, and keep the median (Compiler().compile(input=...) from nexy/modules/compiler);
  • the budget is 50 ms: thirty times the measured value, so a busy CI machine passes, and half of what the HMR promise leaves.

scripts/measure_speed.py measures the same step for the docs: read it first, and keep the two in the same terms.

Done when

  • python -m pytest tests/perf/test_recompile_budget.py passes on develop.
  • Slowing Compiler.compile down on purpose (add a time.sleep(0.1)) makes it fail.

Getting started

Copy the shape of tests/perf/test_startup_budget.py: a temporary project, a few runs, one assertion. Comment here before you start.

Activity

  1. added
    good first issue
    area:compiler
    priority:2
    on Nov 19, 2026
  2. removed their assignment
    on Nov 19, 2026
  3. added
    difficulty:beginner
    on Nov 19, 2026
  4. Espoir-Loem commented on Nov 28, 2026

    @Espoir-Loem
    MemberAuthor

    Je prends cette issue apres #696. Je commence par lire scripts/measure_speed.py et tests/perf/test_startup_budget.py, puis j'ajoute le test avec le budget de 50 ms.

  5. self-assigned this
    on Nov 28, 2026
  6. github-actions commented on Nov 28, 2026

    @github-actions
    Contributor

    Implemented by #700 and merged as b26cbb8. Closing automatically.

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

Metadata

Metadata

Assignees

Labels

area:compilerdifficulty:beginnergood first issuepriority:2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions