glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.12k stars 1.27k forks source link

We consume 33MB for a single page in GLPI #17525

Open orthagh opened 1 month ago

orthagh commented 1 month ago

And some specific libraries are loaded in all pages where they should be only loaded where they are needed. Example for computer list page, unwanted libs:

cconard96 commented 1 month ago

A lot of unneeded scripts are loaded because there is no sector > item > option menu difference between the search and form pages. Unless in debug mode though, the impact isn't that big because they will be cached by the browser.

For me, the computer search page loads 14.2MB of resources and only 422kb actually get transferred when in production env and with an updated DB. The worst offender is the locale JSON data which Chrome isn't using from the cache for some reason (not expired and the same URL is requested each time) at 371kb.

AdrienClairembault commented 1 month ago

Is it really worth it to split libs loading as it is cached after the first load ? This behavior lead to bugs many time because we forgot to load a library for a given page.

cconard96 commented 1 month ago

I think keeping it split is a good idea. Maybe not the way we are doing it now with the menu layout determining what gets loaded and not with as many script imports for a single feature. Maybe something better can be done using webpack. We really need to modernize our JS code in general.

cedric-anne commented 1 month ago

I already have in mind a solution to be able to load modules only when it is necessary, and to also be compatible with CSP (= no inline JS code). I already implemented it on some projects, and it worked well. Anyway, changing this part is too late for GLPI 11.0, it can only be done later.

For GLPI 11.0, we should focus only on what could be considered as a regression, i.e. libs that were not loaded in the same context in GLPI 10.0 and that are really heavy.