Skip to content

perf: PDF generation clones every element string into the group vec #103

@stultus

Description

@stultus

Severity: low
Location: src-tauri/src/screenplay/pdf.rs:116-192 (group_elements and surroundings)

group_elements() clones element_type, text, and typst_inline for every element. For a 120-scene screenplay with ~2000 nodes, that duplicates several megabytes of string data during PDF generation.

This isn't on the editor hot path (export is a one-shot operation) but it does show up in export latency for long scripts.

Fix: Take the input by &[Element] and emit groups holding references with explicit lifetimes; or, since elements aren't reused after grouping, swap clone() for mem::take() / move semantics on the source vec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformancePerformance issue or optimization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions