This is one of a longer sequence of changes we can make to make
the diffing algorithm in Blaze be linear as opposed to quadratic
which it is at the momeny, in general.
This change specifically makes it so that the very common case of
an {{#each}} over an array that switches from empty to a long array
much faster, since the adds in those case are always at the end
of the array. This means there's no bookkeeping necessary to
update indexes.
This changes reduces the rendering time from the example posted
on #3596 from 5000ms to 1729ms.
Fill in all packages without README.md files with a short
README.md mentioning that this is an internal Meteor package.
Break up the top paragraph of a couple of existing README.md
files to be proper long description.
There is more work to do here, involving line wrapping and the like.
It seems that when ObserveSequence observed a Cursor, it used to stop() the observe when the main autorun was invalidated, creating a “gap” during which no callbacks would be received (or fired). This was before we used Deps.nonreactive in the main autorun (shielding the cursor.observe from being stopped). Now the observe is only stopped upon re-run or when the ObserveSequence is stopped, and there is no gap.
Removed references to this gap from comments.
I believe the current code is correct, and in addition, we could now optimize the cursor-to-same-cursor case (and basically not do anything if seq===lastSeq and is a Cursor, i.e. not stop the old handle, create a new handle, or diff).
This was originally introduced with
f1b77fec96, but it looks
like all of our tests now pass. (Maybe eliminating `rewind` in
b5a0613f85 made this no
longer necessary?)
If we find that this commit did break something, let's make sure to
add a failing test before reverting.
It seems like a good practice for tests to always be grouped under their package name, so that it’s easy to find the tests when they fail. It’s confusing to have the tests in packages like “spacebars-tests”, “spacebars-compiler”, and “templating” be in various groups like “spacebars - templates” and “spacebars - templating”.
I didn’t go through and enforce this convention in all packages, just a few, but I think it would be good and not too hard to do the rest sometime.
We now call 'removedAt' and 'changedAt' with indices (instead
of 'removed' and 'changed'). While at it, fix a bug where
the 'movedTo' callback was firing with incorrect
indices.
commit f44d03d2c8bbfca32ae08fdabef35472c62042eb
Author: Avital Oliver <avital@thewe.net>
Date: Tue Apr 15 14:54:29 2014 -0700
A more complicated movedTo test that should catch a bug
commit 24f9ba3ffc708cf1af34e434ddf033c54d246614
Author: Avital Oliver <avital@thewe.net>
Date: Tue Apr 15 14:05:44 2014 -0700
Update tests and {{#each}} for new observe-sequence