Hi there,
in the last couple of days we changed the navigation manager to also
accept closures as navigation entries.[0][1] In some free time, I
started profiling the activity app, and noticed that 80% of the time is
spend loading the app.php of all the apps that are installed in my test
enviroment.
One of the heavy slow downs is the registration of the navigation
entries. This is caused by a few issues, that are involved here:
1. We load the language of your app, to add the translated version
of the app name to the entry
2. We try to find the icon of your app
3. We load the routing of your app, to create the "go to" URL
However, in 95% of the calls, we don't display the navigation, so all
this loading just goes down the sink. One solution to this problem is,
to only load all that stuff when necessary. To allow this we added
support for Closures in the navigation manager.
When you move all the work into the closure, it is only executed when
the navigation is actually displayed. The patch for the activity app was
quite simple, just wrap the array with "function () { return " and "};" [2]
This saved 0.04sec on the activity app.php alone. So when you have 10
app navigation entries (or files app sidebar entries) this sums up to
almost half a second on each request.
The other thing that I want to say here is, please try to avoid loading
css/js files in app.php, load them in your template file and as late as
possible. There is no need to load e.g. files_pdfviewer JS and CSS files
for a webdav/ajax/settings call, because we don't display pdfs there,
but that is what happens atm (and the same applies to a couple of other
apps).
So use that file with care and make it as lightweight as possible, thanks!
cheers Joas
[0] - https://github.com/owncloud/core/pull/14931
[1] - https://github.com/owncloud/core/pull/14952
[2] -
https://github.com/owncloud/activity/commit/a20052a397a2ee7ca4c7e20d62b452bad055ca1e?w=1
_______________________________________________
Devel mailing list
Devel@owncloud.org
http://mailman.owncloud.org/mailman/listinfo/devel