Skip to content

npm: marked workload (mdapp.ts) is superlinear — 10 docs 0.16s, 100 docs >5min, 300 docs >55min (node: ~1s for 300) #7692

Description

@proggeramlug

Summary

With #7689 fixed (PR #7691), the marked npm package now runs correctly under Perry — but the issue's full comparison workload cannot be run to completion because Perry's runtime scales severely superlinearly in the number of documents parsed.

gc-handoff/apps/mdapp/mdapp.ts (300 generated markdown docs through marked.parse, counting <h2> tags):

docs node perry (perry-dev profile @ 94ad784 + #7691 fix)
10 ~0.1 s, 20105 60 0.16 s, 20105 60 (matches)
100 ~0.4 s killed at 5 min, not finished
300 ~1 s, 612040 1800 killed at ~55 min, not finished

10 → 100 docs is a >1800× wall-clock blowup for 10× the input. Per-doc input size is essentially constant, so something in the per-parse path is superlinear in cumulative work — a side table growing per allocation/registration with O(total) lookups, GC behavior, or similar. The process stays ~50% CPU-busy the whole time (computing, not blocked).

Caveats on the numbers: measured on a loaded dev machine with an opt-level=1 (perry-dev) runtime, so the absolute times overstate the constant factor — but not the growth curve. Worth re-measuring --release on the quiet bench host first to get a clean curve before digging.

Repro

cd gc-handoff/apps/mdapp
export PERRY_RUNTIME_DIR=<repo>/target/release
<repo>/target/release/perry mdapp.ts -o p_mdapp
time ./p_mdapp        # does not finish in any reasonable time
# vs: edit the loop to `i < 10` — finishes instantly with output matching node

Context

This is the axis of the scriptc comparison in #7689: scriptc --dynamic produces 612040 1800 through its embedded engine in seconds; Perry now computes correct results natively but cannot finish the workload. Correctness landed in #7691; this issue tracks the scaling defect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions