kdion4891 / laravel-livewire-tables

A dynamic, responsive Laravel Livewire table component with searching, sorting, checkboxes, and pagination.
302 stars 41 forks source link

Slow check box select #15

Closed booni3 closed 4 years ago

booni3 commented 4 years ago

I am not sure if you agree, but I feel like the speed of the check box-checking is quite slow, even with a small number of models in the table.

Do you have any hunches as to what may be causing this? Quite a while ago I implemented my own attempt. I actually never pushed the code and I think it is on my old laptop so would have to go digging for it, but this was the result.

Kapture 2019-12-01 at 20 05 06

Just to be clear, your package is superior in every way. I just wonder if we can make this particular element a little faster.

Not sure if you have looked into it or have any ideas? I would be happy to have a look into it also.

booni3 commented 4 years ago

Sorry, I just realised this may not be your package but something in my app. Can you confirm that you do not see any speed issues your side? Your home page gif suggests not.

My current install looks like this:

Kapture 2020-03-11 at 22 54 47

kdion4891 commented 4 years ago

It takes a moment because it is selecting the rows on ALL pages, so it does a lookup of all of the model ID's that have been filtered. If you click the check all box, you will see if you go through the pages that ALL checkboxes are checked on all pages.

booni3 commented 4 years ago

I am not sure that is the issue I am seeing here. I extended your class to ensure we only select the visible page (so 15 - 20 rows) and the speed issue is still there.

I also tried installing your package on Laravel 6 with Livewire 0.6 and the speed issue goes away (or at least is vastly improved). I am not too sure what could have changed.

I am going to look at doing a fresh install on L6 and L7 with Combo's of livewire/your app and see what I can find out.

It's not a big deal, but the speed change is degraded enough that I think it is worth a look into.

booni3 commented 4 years ago

OK, this is actually the pagination element that is slow. Even if we just select the first 25 out of 50,000 rows there are still 4 queries being made to the Database including 2 x count(*). This pushes the checkbox select up to around 500ms for the whole operation. Not an issue the implementation here though.