Skip to content

perf(platform): shrink the convex push further — jsdom→linkedom, lodash subpath imports #2581

Closed as not planned

Description

@larryro

Problem

The self-hosted backend caps a function push at 42.92 MiB zipped (hard const, see #2579). PR #2548 brought a fresh-backend push from 42.97 to 35.38 MiB, but the total includes the external-deps package the backend re-resolves from npm on every fresh backend, so headroom erodes on its own as upstream transitive versions grow — the margin is structural, not static.

Current behaviour

Fresh-backend push composition (backend log, 2026-07-08):

  • external-deps package 20.2 MiB zipped — dominated by mssql→tedious→@azure/* (~12 MiB, SQL-Server integration feature weight, not trimmable) and jsdom (~5 MiB closure incl. tldts/css-tree/@bramus)
  • app modules 13.0 MiB zipped (roughly half source maps, which the CLI always uploads)
  • component packages ~2.1 MiB

Proposed change

  1. jsdom → linkedom (biggest lever, ~4–5 MiB zipped): only three crawler helpers import jsdom (crawler/helpers/structured_data.ts, crawler/helpers/content_filter.ts, crawler/lib/discovery.ts), all querySelector/textContent-level usage — no Readability, no layout. linkedom bundles tree-shaken (external entry disappears entirely). Needs fixture-page tests around the three helpers since HTML-parser edge behaviour (malformed markup recovery, entity handling) differs.
  2. lodash CJS → per-method subpath imports (~0.3–0.5 MiB zipped): import { get } from 'lodash' sites (~15 files under convex/) pull the full non-tree-shakeable CJS build into BOTH the isolate and node bundles. lodash/get-style imports (or lodash-es) shrink it; mechanical change.
  3. Isolate _deps audit (opportunistic): largest isolate chunks (~600 KB each) haven't been attributed; check for accidental heavy imports into the default runtime.

Acceptance criteria

  • Fresh-backend push (scratch convex-local-backend, empty cache) lands ≤ 30 MiB zipped
  • Crawler extraction behaviour covered by fixture tests before/after the jsdom swap
  • No new externalPackages entries

Activity

  1. added
    priority: medium
    perf
    service: platform
    on Jul 8, 2026
  2. yannickmonney commented on Jul 11, 2026

    @yannickmonney
    Contributor

    Status after PR #2674: jsdom→linkedom swap landed (three crawler helpers, fixture tests for malformed-markup/entity behaviour before+after; stale jsdom externalPackages entry removed) and the lodash CJS→subpath imports were already on main via #2587. Remaining, deliberately open: the ≤30 MiB fresh-backend push AC (scratch-backend/CI-observable only) and the isolate _deps audit (static inspection found no clear culprit — xlsx/jszip are node-bundle-only, pdfjs already lazy; needs a bundle visualizer or scratch push).

  3. yannickmonney commented on Sep 27, 2026

    @yannickmonney
    Contributor

    Closing as obsolete. 0.5.0 (#3107) moved the platform off Convex: services/platform/convex/ no longer exists and no package.json depends on Convex, so there is no function push left to shrink. The two concrete changes had already landed (linkedom in #2674, the lodash subpaths in #2587), and the 30 MiB push criterion has nothing left to measure.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions