zorab47 / active_admin-sortable_tree

Show ActiveAdmin index as a nested tree with drag'n'drop
MIT License
163 stars 127 forks source link

improve resource loading performance when updating #77

Open atitan opened 6 years ago

atitan commented 6 years ago

The original creates a lot of N+1 queries when collection set is large.

Query everything in the first place and assign them.

zorab47 commented 5 years ago

Nice! Is there a maximum number of records where performance degrades?

atitan commented 5 years ago

Currently we have 300+ categories listing as a tree. It takes about 15~20 seconds to update for every single drag in the admin panel.

I was able to cut it down to 2 seconds with this patch.

zorab47 commented 5 years ago

Making the method of loading records configurable could work, but loading all records shouldn't be the default.

On Wed, Aug 29, 2018 at 22:32 Sh Lin notifications@github.com wrote:

Currently we have 300+ categories listing as a tree. It takes about 15~20 seconds to update for every single drag in the admin panel.

I was able to cut it down to 2 seconds with this patch.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zorab47/active_admin-sortable_tree/pull/77#issuecomment-417178706, or mute the thread https://github.com/notifications/unsubscribe-auth/AABiBjEYPdoGvh2cCfRUE4FS3IFAxiCmks5uV1y5gaJpZM4WFNIr .