LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.
GNU General Public License v3.0
371 stars 220 forks source link

Schedule->Bookings page performance is very bad #370

Closed JohnVillalovos closed 1 month ago

JohnVillalovos commented 1 month ago

When I go to Schedule->Bookings the performance is really bad.

Previously we were running version 2.7.7. And performance wasn't fast but it was acceptable.

Now I have filters set so I am showing one week and seven resources. And it takes almost 20 seconds for the "Loading reservations" status to disappear.

We have over 1,000 resources. And if I foolishly happen to load the page without filters the browser comes to a halt and is completely unresponsive.

@ramartins02 Not sure if this is related to some changes that were made to Web/scripts/schedule.js I am trying to figure out the issue but my JavaScript skills are lacking. But I'm working on it and will see what I can figure out.

JohnVillalovos commented 1 month ago

Update. So if I comment out schedule.init(); [1] then the page loads just fine. So to me it points at the JavaScript being the issue. I was able to load a whole week schedule with over 1,000+ resources and the browser didn't lag.

Of course it isn't usable this way as I can't make reservations 😄

[1] https://github.com/LibreBooking/app/blob/22c526a2a330091a6f18ade54697f64e0143ab05/tpl/Schedule/schedule.tpl#L452

JohnVillalovos commented 1 month ago

As a note I checked out the Web/scripts/scheduler.js file from commit c90f62f3c18876482e39301e1c98532b36f771cb

And using that version things are much improved on performance for me. No idea if that will break something, but so far in very limited testing it is working.

Update: Performance did improve but not greatly.

JohnVillalovos commented 1 month ago

Even with the old Web/scripts/scheduler.js performance is still not to the level version 2.7.7.

But version 2.7.7 is much much faster. Where the develop branch took around 120 seconds to load approximately 300 resources. 2.7.7 took around 5 seconds.

And 2.7.7 can load 1200 resources in 27 seconds. develop branch takes many minutes to load.

JohnVillalovos commented 1 month ago

So the reason 2.7.7 (https://github.com/LibreBooking/app/commit/88d4673161a9e4c43a95d5796ea24a52dd70df96) is so much faster, is that the server side PHP will populate the reservations in the HTML that is sent down.

In the current version the JavaScript will populate the reservations and it is slow...