montagejs/montage — pull request #1247 by kriskowal (2013-08-07 03:10:33+00:00)
Title: Optimize repetition iteration control for set

We encountered a performance problem in the interaction between Flow and
Repetition. The Flow updates the visible indexes of the repetition
during the draw cycle, and was found to be taking an exobitant amount of
time. The visible indexes updates occur as a sequence of calls to `set`
on `visibleIndexes`, each of which propagates a call to
`handleOrganizedContentRangeChange` on the repetition, updating the
value at a single index. As such, it is possible to bypass the check
for whether enough iterations have been created (none will be created or
destroyed), and possible to avoid splicing the iteration in and out.
This optimization just changes the bound content for the existing
iterations in place.

A previous revision of Repetition, before the integration of bindings,
certainly did contain this optimization.