Use Pagy or Will Paginate instead of Kaminari
AA uses kaminari, but this gem is quite inefficient, both Will Paginate and Pagy gems are much faster and CPU/RAM efficient as shown here, also they are more active than kaminari, just compare the date of the latest versions of each gem: Will Paginate, Pagy and kaminari
TL:DR;
| Pagy | Will Paginate | Kaminari |
|---|---|---|
| ~40x faster | ~18x slower | ~40x slower |
| ~36x less memory | ~18x more memory | ~36x more memory |
| ~8x less LOC | ~8x more LOC | ~5x more LOC |
| ~7x less modules | ~6x more modules | ~7x more modules |
| ~4x less methods | ~4x more methods | ~4x more methods |
| ~1410x more efficient | ~310x less efficient | ~1410x less efficient |
Why are we using kaminari?
+1 for pagy
ActiveAdmin has been using kaminari from the very beginning, back to when the pagy alternative didn't exist.
Ideally I would make the pagination engine being used under the hood configurable, but it sounds like a bit of work.
The truth is, the more I read about the different pagination gems, the more I realize that Pagy is the only one worth using. It's by far the fastest one, the one that uses less memory and the most recommend from Rails gurus.
Why make it configurable and not simply change to Pagy?
We've had issues in the past where people using will_paginate in their frontend will have issues with activeadmin's pagination (because of the way these gems hook into activerecord associations). I figure if people could configure activeadmin to use the same pagination gem they're already using in their application, that would simplify people's life.
That said, it sounds like pagy is superior in every way, so I would also accept contributions simply changing the kaminari dependency to pagy (ideally in a backwards compatible way).
Do we have any progress on this?
Do we have any progress on this?
@sikandartariq1 would you be willing to have a try at the change? 🙏
@sunny sure, let's do it.
@deivid-rodriguez it's worth mentioning that pagy does not hook into AR associations and is totally agnostic so it could coexist with other pagination gems used elsewhere in the app.
Also, migrating from other pagination gems to pagy is quite straightforward for most apps, so having it as a AA dependency would motivate users to improve also the rest of their apps.
@sikandartariq1 I'm happy to help or code review if you need me.
@sikandartariq1 Are you still working on it?
@sikandartariq1 Are you still working on it?
+1 Has there been any progress on this?
I don't see us replacing Kaminari with another option since Kaminari works well and is well supported. I’m open though for making this configurable with other pagination libraries. That should be covered by a new issue though. Thank you.
If this problem has been solved around 2013 or even earlier, then it is worth posting a link to the documentation here. I can confirm that will_paginate, activeadmin and kaminari work simultaneously in my project.
https://github.com/activeadmin/activeadmin/blob/master/docs/0-installation.md#will_paginate