tbranyen/backbone.layoutmanager — pull request #421 by STRML (2014-01-07 00:28:10+00:00)
Title: Use `requestAnimationFrame` to coalesce renders and discard unneeded renders.

`useRAF` coalesces repeated renders using the tick of the browser's native `requestAnimationFrame`, allowing us to safely discard render work that would not be seen before the next frame.

This brings with it significant performance advantages, especially in situations where views may be listening to events on collections, such as 'add', and 'remove'. Rather than rerender for every event thrown, renders that would not be seen are thrown out.

It is still safe to use `.then()` on the promise returned by a render, as it will be resolved at the next tick of `requestAnimationFrame`, regardless of whether or not it was the actual render call used.

This change requires that we assume every render to be async, and removes the current ambiguity where renders are synchronous, unless they contain a single async component. It is now required that users treat each and every render as async, because it is guaranteed to be.

This behavior may be turned off without consequence by setting `"useRAF": false` inside LayoutManager.configure().

@tbranyen, @SBoudrias, @jugglinmike, I'm interested in whether or not you think this change is worthwhile and if so, how best to integrate it with LM. The removal of support for synchronous `render()` will certainly break some code in the wild.