caching really *is* evil :-)
(if it weren’t for performance…)
pull/3/merge
Jens Mönig 2015-03-06 14:12:48 +01:00
rodzic 168c328836
commit e906290f47
2 zmienionych plików z 30 dodań i 2 usunięć

Wyświetl plik

@ -9,7 +9,7 @@
written by Jens Mönig
jens@moenig.org
Copyright (C) 2014 by Jens Mönig
Copyright (C) 2015 by Jens Mönig
This file is part of Snap!.
@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2015-February-28';
modules.blocks = '2015-March-06';
var SyntaxElementMorph;
@ -382,9 +382,32 @@ SyntaxElementMorph.prototype.inputs = function () {
return part instanceof SyntaxElementMorph;
});
}
// this.debugCachedInputs();
return this.cachedInputs;
};
SyntaxElementMorph.prototype.debugCachedInputs = function () {
// private - only used for manually debugging inputs caching
var realInputs, i;
if (!isNil(this.cachedInputs)) {
realInputs = this.parts().filter(function (part) {
return part instanceof SyntaxElementMorph;
});
}
if (this.cachedInputs.length !== realInputs.length) {
throw new Error('cached inputs size do not match: ' +
this.constructor.name);
}
for (i = 0; i < realInputs.length; i += 1) {
if (this.cachedInputs[i] !== realInputs[i]) {
throw new Error('cached input does not match ' +
this.constructor.name +
' ' +
i);
}
}
};
SyntaxElementMorph.prototype.allInputs = function () {
// answer arguments and nested reporters of all children
var myself = this;
@ -4614,6 +4637,7 @@ RingMorph.uber = ReporterBlockMorph.prototype;
// RingMorph preferences settings:
RingMorph.prototype.isCachingInputs = false;
// RingMorph.prototype.edge = 2;
// RingMorph.prototype.rounding = 9;
// RingMorph.prototype.alpha = 0.8;

Wyświetl plik

@ -2462,3 +2462,7 @@ ______
150302
------
* BYOB: fixed #730
150306
------
* Blocks: fixed #736