Merge lp://staging/~gary/juju-gui/fixDeltaFromChangeEdgeCase into lp://staging/juju-gui/experimental

Proposed by Gary Poster
Status: Merged
Merged at revision: 1030
Proposed branch: lp://staging/~gary/juju-gui/fixDeltaFromChangeEdgeCase
Merge into: lp://staging/juju-gui/experimental
Diff against target: 169 lines (+69/-29)
2 files modified
app/views/databinding.js (+57/-29)
test/test_databinding.js (+12/-0)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/fixDeltaFromChangeEdgeCase
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+185053@code.staging.launchpad.net

Description of the change

optimize and fix databinding.deltaFromChange

This is a grabbag of three small changes. The biggest change is that I did some optimizations of databinding.deltaFromChange and fixed an edge case (with test). I also optimized _setupDependencies for that edge case, added some documentation about bindings (so I could refer to it myself), and optimized the bind/_bind pair a bit by removing redundant calls to code that iterates over all bindings (they are now done once in bind, rather than once per viewlet in _bind).

https://codereview.appspot.com/13348056/

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

Reviewers: mp+185053_code.launchpad.net,

Message:
Please take a look.

Description:
optimize and fix databinding.deltaFromChange

This is a grabbag of three small changes. The biggest change is that I
did some optimizations of databinding.deltaFromChange and fixed an edge
case (with test). I also optimized _setupDependencies for that edge
case, added some documentation about bindings (so I could refer to it
myself), and optimized the bind/_bind pair a bit by removing redundant
calls to code that iterates over all bindings (they are now done once in
bind, rather than once per viewlet in _bind).

https://code.launchpad.net/~gary/juju-gui/fixDeltaFromChangeEdgeCase/+merge/185053

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/13348056/

Affected files (+71, -29 lines):
   A [revision details]
   M app/views/databinding.js
   M test/test_databinding.js

Revision history for this message
Gary Poster (gary) wrote :

Line-by-line comments for reviewers.

https://codereview.appspot.com/13348056/diff/1/app/views/databinding.js
File app/views/databinding.js (right):

https://codereview.appspot.com/13348056/diff/1/app/views/databinding.js#newcode186
app/views/databinding.js:186: var index = indexBindings(bindings, null,
true);
The "true" argument and then the "result.bindings.push.apply" below is
the real fix. All the other changes streamline the logic, resulting in
much fewer duplicate results and hopefully clearer reading.

https://codereview.appspot.com/13348056/diff/1/app/views/databinding.js#newcode393
app/views/databinding.js:393: this._modelChangeHandler();
These were moved from _bind, mostly as an optimization for reading but
also to prevent unnecessary duplication of work.

https://codereview.appspot.com/13348056/diff/1/app/views/databinding.js#newcode533
app/views/databinding.js:533: index[dep] = source;
This is just an optimization, so that if we have more than one of these
implicit bindings on the same source, we don't create multiple copies of
the source. It wasn't causing a bug, but this just makes it easier to
debug further downstream.

https://codereview.appspot.com/13348056/

Revision history for this message
Gary Poster (gary) wrote :

*** Submitted:

optimize and fix databinding.deltaFromChange

This is a grabbag of three small changes. The biggest change is that I
did some optimizations of databinding.deltaFromChange and fixed an edge
case (with test). I also optimized _setupDependencies for that edge
case, added some documentation about bindings (so I could refer to it
myself), and optimized the bind/_bind pair a bit by removing redundant
calls to code that iterates over all bindings (they are now done once in
bind, rather than once per viewlet in _bind).

R=benji
CC=
https://codereview.appspot.com/13348056

https://codereview.appspot.com/13348056/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches