Skip to content

Build time regression since 1.0.0-beta.7: action owner manifest repeats getModuleInfo/resolve per route (#2520) #3414

Closed

Description

@shortstuffsushi

Upgrading from 1.0.0-beta.6 to 1.0.0-beta.7 made our production build about 1.75x slower: 27.5s -> 49.7s locally (Apple M4 Max) and 137s -> 245s in CI. A local bisect points at #2520 (0736fdd). Its parent 6736c31 builds our app in 26.9s; 0736fdd takes 45.2s. The code is unchanged on main (07fa109) and in 1.0.0-beta.11.

Environment

  • App Router app with server actions, 380 routes, ~10.2k client modules
  • vite 8.1.5, @vitejs/plugin-rsc 0.5.35, next 16.3.5, Node 25

Stage times (vinext build)

analyze client refs analyze server refs rsc client ssr
6736c31 (before #2520) 4.3s 4.1s 4.2s 8.0s 4.1s
0736fdd (#2520) 4.4s 4.2s 9.5s 20.7s 4.1s

Cause

vinext:action-owner-manifest's generateBundle walks the final module graph once per route (collectRscActionReachability, addClientActionReachability in packages/vinext/src/build/action-owner-manifest.ts). Every walk calls Rolldown's this.getModuleInfo() for each visited module, with no reuse across routes. The client pass also awaits this.resolve() for every client reference of every route (resolveClientReferenceImportIds), serially.

Timing the hook on our app:

  • rsc: 4.8s, 1,239,421 getModuleInfo calls (4.2s inside them)
  • client: 11.7s, 2,071,417 getModuleInfo calls (7.8s) and 13,920 this.resolve calls (2.4s)

Memoizing module info by id and resolved client reference ids by import id, per helper call, brings those passes down to 0.23s and 1.0s and the build back to beta.6 speed, with an identical action owner manifest. I have a small PR ready with that change and a regression test; it will follow this issue.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions