Speeding up my Nextcloud - part 1
Following my analysis of why my Nextcloud Files app takes so long to load, I spotted several culprits while executing the JS files.
The unsupported browser check that takes ~200ms
One of them is due to the check of unsupported browsers, taking up to 242ms:
The root of the issue relies in the use of a dependency, browserslist-useragent-regexp, that itself relies on regexp-tree.
I am having a hard time parsing the compiled code but it seems that this dependency builds a heavy regex and tries to optimize it by replacing things such as [0-9]
with \d
and this process is CPU heavy, taking 176ms.
Now, there is probably room for improvement but I would have to fix a dependency of dependency and then wait for Nextcloud to update it…
The good news is Nextcloud allows to disable the whole unsupported browser check by setting no_unsupported_browser_warning
to true
in the config.php
file.
Since I am the only user of my instance and I use evergreen browsers, I can disable this check safely.
The thing is, with Nextcloud version 27 the heavy code is still executed before the parameter is checked, meaning that those 176ms are still lost for nothing.
Fortunately this code is loaded asynchronously, only if the parameter is not true, in Nextcloud 28.
Conclusion
I'll just wait for the next major release, enable the no_unsupported_browser_warning
parameter and move on to the next bottleneck!