activeadmin icon indicating copy to clipboard operation
activeadmin copied to clipboard

Use Pagy or Will Paginate instead of Kaminari

Open oicitrapdraz opened this issue 6 years ago • 10 comments

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?

oicitrapdraz avatar Sep 18 '19 03:09 oicitrapdraz

+1 for pagy

sikandartariq1 avatar Oct 12 '19 07:10 sikandartariq1

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.

deivid-rodriguez avatar Oct 12 '19 14:10 deivid-rodriguez

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?

oicitrapdraz avatar Oct 12 '19 14:10 oicitrapdraz

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).

deivid-rodriguez avatar Oct 12 '19 14:10 deivid-rodriguez

Do we have any progress on this?

sikandartariq1 avatar Jun 29 '20 15:06 sikandartariq1

Do we have any progress on this?

@sikandartariq1 would you be willing to have a try at the change? 🙏

sunny avatar Jul 12 '20 09:07 sunny

@sunny sure, let's do it.

sikandartariq1 avatar Jul 12 '20 09:07 sikandartariq1

@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.

ddnexus avatar Aug 01 '20 02:08 ddnexus

@sikandartariq1 Are you still working on it?

MatheusRich avatar May 10 '21 13:05 MatheusRich

@sikandartariq1 Are you still working on it?

+1 Has there been any progress on this?

williamair1 avatar Aug 17 '22 10:08 williamair1

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.

javierjulio avatar Mar 12 '23 06:03 javierjulio

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

aivils avatar Nov 02 '23 06:11 aivils