Skip to content

perf(doc): eliminate O(B^2) ModelState::body scans in cut/join eval and cache detach #27054

Done

Description

@AXKore

Summary

In crates/doc/src/eval.rs (note_cut_cavity, join_pieces_added, join, Form combine checks, and ModelState::with_relative) and crates/doc/src/naming.rs (try_detach_for_cache), body/target lookups perform linear ModelState::body(...) scans across the current body list per body or target (O(B^2) per feature, scaling to O(F * B^2) across multi-body timelines).

Measured Release Baseline

  • helpers_400x200 (400 bodies × 200 targets): 55.12 ms (160,000 body searches)
  • Incremental eval (240 blocks + 40 cuts + 40 joins): 44,920 body searches (538.28 ms total)
  • Cold eval (240 blocks + 40 cuts + 40 joins): 29,600 body searches (787.20 ms total)

Next Step

A verified fix is ready to open as a PR.

Activity

  1. added
    needs-triage
    in progress
    on Dec 6, 2026
  2. github-actions commented on Dec 6, 2026

    @github-actions
    Contributor

    Claimed by @AXKore through #27056. The claim lapses after 14 days without pushes.

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

Metadata

Metadata

Assignees

Labels

in progressneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions