I have a custom module which builds a set of complicated forms, and these forms are built dynamically (the option lists for certain SELECT items, for example, are fetched via an API call). Some of these forms take 14 seconds to load, whereas a simple "static" form takes 2 seconds.
The data behind the dynamic forms does not change often and so I want to cache the render array of the form, so that a complicated form could also load in 2 seconds. A cache life of an hour would be fine, for example.
I have not yet found how do this, or at least what I have tried has not helped the speed.
All forms in question are only available to logged in users, as they are for staff use only.
On /admin/config/development/performance I have "Browser and proxy cache maximum age" set to 1 hour.