refinery/refinerycms — pull request #2747 by vladimir-tikhonov (2014-11-07 17:07:41+00:00)
Title: Speed up page reordering

Updated version of #2746, fixed issue with AR cache.

`update_positions` and `update_child_positions` methods perform a lot of useless UPDATE queries. Pull request adds few checks to prevent this. Fixes #2702 and #2631

Some benchmarking (315 pages, https://gist.github.com/vladimir-tikhonov/7aea6077be29c38ab6f7):
__Before:__
> Click 'Reorder Pages' and then immediately 'Done Reordering Pages': __21981.7ms__
> Click 'Reorder Pages', mix pages for 5 seconds and 'Done Reordering Pages': __21779.1ms__

__After:__
> Click 'Reorder Pages' and then immediately 'Done Reordering Pages': __644.8ms__
> Click 'Reorder Pages', mix pages for 5 seconds and 'Done Reordering Pages': __2878.9ms__