Skip to content

Commit d9d432d

Browse files
committed
little opti
1 parent b1827f6 commit d9d432d

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/view/component.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,9 @@ Component.prototype._update = function (changes) {
768768
};
769769

770770
if (changes) {
771-
changes = removeExcrescentChanges(changes);
771+
if (changes.length > 1) {
772+
changes = removeExcrescentChanges(changes);
773+
}
772774

773775
if (this.source) {
774776
this._srcSbindData = nodeSBindUpdate(
@@ -791,7 +793,8 @@ Component.prototype._update = function (changes) {
791793
);
792794
}
793795

794-
each(changes, function (change) {
796+
for (var i = 0; i < changes.length; i++) {
797+
var change = changes[i];
795798
var changeExpr = change.expr;
796799

797800
each(me.binds, function (bindItem) {
@@ -845,7 +848,7 @@ Component.prototype._update = function (changes) {
845848
needReloadForSlot = needReloadForSlot || changeExprCompare(changeExpr, bindItem.expr, me.scope);
846849
return !needReloadForSlot;
847850
});
848-
});
851+
}
849852

850853
if (needReloadForSlot) {
851854
this._initSourceSlots();

src/view/template-component.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ TemplateComponent.prototype._update = function (changes) {
379379
};
380380

381381
if (changes) {
382-
changes = removeExcrescentChanges(changes);
382+
if (changes.length > 1) {
383+
changes = removeExcrescentChanges(changes);
384+
}
383385

384386
if (this.source) {
385387
this._srcSbindData = nodeSBindUpdate(
@@ -402,7 +404,8 @@ TemplateComponent.prototype._update = function (changes) {
402404
);
403405
}
404406

405-
each(changes, function (change) {
407+
for (var i = 0; i < changes.length; i++) {
408+
var change = changes[i];
406409
var changeExpr = change.expr;
407410

408411
each(me.binds, function (bindItem) {
@@ -456,7 +459,7 @@ TemplateComponent.prototype._update = function (changes) {
456459
needReloadForSlot = needReloadForSlot || changeExprCompare(changeExpr, bindItem.expr, me.scope);
457460
return !needReloadForSlot;
458461
});
459-
});
462+
}
460463

461464
if (needReloadForSlot) {
462465
this._initSourceSlots();

0 commit comments

Comments
 (0)