Skip to content

Performance: Large imported projects take 90-120s or more to finish asset loading in Assets view #403

Description

@hellosamyak

Summary

When importing a project from an existing directory, large projects take too long to finish asset loading in the Assets view.
The loading state persists for a long time with the message:

Additional details about the assets are still loading...

This is reproducible and benchmarked.

Environment

  • OS: Windows
  • App: StatWrap (local workspace build)
  • Date tested: 2026-04-18
  • Tested project: Large imported directory project
  • Project path: redacted (windows local path)
  • Repo note: Any large existing-directory import with similar size reproduces the issue.

Steps to Reproduce

  1. Open StatWrap.
  2. Choose "Associate a project with an existing directory".
  3. Import a large directory.
  4. Select that project and open Assets.
  5. Observe loading duration and status message.

Actual Behavior

  • Assets remain in loading state for a long time.
  • UI shows:

Additional details about the assets are still loading...

  • Full asset detail scan took ~94 to 116 seconds in benchmark runs.

Expected Behavior

  • Assets should load significantly faster for large projects.
  • UI should become interactive quickly, ideally with incremental/background enrichment.

Benchmark Evidence

Tested on a large imported project:

  • Files: 17,412
  • Directories: 1,483
  • Discovered assets: 18,895
  • Potential code files scanned by handlers: 10,602

Scan timings:

  • Tree-only scan: 959 ms
  • Full handler scan: 116,135 ms
  • Additional overhead: 115,176 ms (~121x slower than tree-only)

Additional run (full scan): 94,439 ms

Suspected Cause

  • Full recursive scan runs on project select.
  • Scan uses synchronous filesystem operations and per-file handler parsing.
  • For large trees, handler work dominates runtime.

Impact

  • Poor UX on large projects.
  • Users may think app is frozen or stalled.
  • Slows initial review of imported existing-directory projects.
  • Re-selecting projects can re-trigger costly scans.

Acceptance Criteria

  • Loading time for large imported projects is significantly reduced.
  • Loading indicator duration is substantially shorter.
  • No regression in asset metadata correctness.
  • Add/keep a performance check for large project scans.

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