I am not sure if it is the placebo effect but I think turning on php jit helps:
services.nextcloud.phpOptions = options.services.nextcloud.phpOptions.default // {
"opcache.jit" = "tracing";
"opcache.jit_buffer_size" = "100M";
# recommended by nextcloud admin overview
"opcache.interned_strings_buffer" = "16";
};
I also pre compress all my web resources with brotli and zopfli and then serve the files with nginx.
Basically I am running this script in postFixup
find "$prefix" -type f -regextype posix-extended -iregex '.*\.(css|csv|html?|ini|js|js.map|json|md|scss|svg|txt|xml)' -exec echo Compressing '{} ...' \; -exec brotli '{}' \; -exec zopfli '{}' \;