payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
27.66k stars 1.72k forks source link

perf: significantly reduce form-state response size by up to 2x #9388

Open jacobsfletch opened 1 day ago

jacobsfletch commented 1 day ago

This significantly optimizes the form-state response, reducing its size by up to more than 2x. This has rolling effects on initial page size as well, where the initial state for the entire form is sent through the request. To achieve this, we do the following:

For backward compatibility, some of these changes are behind a temporary experimental.optimized flag.

Results

The following results were gathered by booting up each test suite listed below using the existing seed data, navigating to a document in the relevant collection, then typing a single letter into the noted field in order to invoke new form-state. The result is then saved to the file system for comparison.

Test Suite Collection Field Before After
field-perf blocks-collection layout.0.field1 177 kB 98 kB
fields array-fields items.0.text 8 kB 4 kB
fields block-fields blocks.0.richText 28 kB 22 kB