Remove package bloat from V3 beta (slow load times) #9085
Replies: 2 comments
-
Fully support this. This is also in line with what jmikrut said with the original 3.0 announcement stream where a big motivation for moving to Next was to heavily cutdown on external dependencies, reduce bundle size, and therefore increase performance. Would love for the inclusion of gql and other heavier things to be something that is more modular and configurable within payload.config.ts. |
Beta Was this translation helpful? Give feedback.
-
Agree on the code side. For GraphQL, I thought it doesn't get loaded unless you install Also, you're supposed to use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, Payload has a lot of stuff included by default, which results in extremely bad load times. This is what it looks like to compile a blank Next.js page after
create-payload-app
:It takes 3.6 seconds for the initial load, then 99ms for each change.
If I add a simple
getPayload()
call to fetch data, this happens:Now it takes 13.3 seconds for the initial load, then 425ms for each change.
Basically, simply fetching data from Payload results in 2.7 times slower load time.
But if we move over to the admin, things get even worse:
Now you have to stare 24.2 seconds at a blank screen, then 769ms on each update (in this example, I'm adding another field to the default Media collection).
I understand that this impacts only local dev, but that's my main concern — it's really not a good DX. Sure, it's not that bad, but once you start adding other packages (you know... for your actual site), the load times can really spiral out of control. In my book, over 10 seconds load for a "Hello World" is crazy. Almost 30 seconds for the default
create-payload-app
is even crazier.Proposed Solution
Some of the functionality can be added separately as plugins. For example:
I haven't measured the actual impact of loading those dependencies, but in our project, they're just dead weight. And I bet that compiling the Monaco editor doesn't come cheap.
In conclusion, jumping from 514 modules to 2711 modules for a simple Hello World page doesn't seem right.
Here's a reproduction repo: https://github.com/hdodov/test-payload/tree/slow-load-times
Beta Was this translation helpful? Give feedback.
All reactions