From f966758bcee7d5dcc26365d9d3c1d6e664bdb805 Mon Sep 17 00:00:00 2001 From: Eric Rowell Date: Mon, 2 Dec 2013 00:06:27 -0800 Subject: [PATCH] removed before event emitter for attr changes to improve performance. I don't think it's really needed --- src/Node.js | 5 +++-- test/performance/common/random-squares.js | 2 +- test/performance/random-squares-dev.html | 23 +++++++++++++++++++++ test/performance/random-squares-v4.7.4.html | 3 +-- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 test/performance/random-squares-dev.html diff --git a/src/Node.js b/src/Node.js index 5f2c94e1..5388f90d 100644 --- a/src/Node.js +++ b/src/Node.js @@ -1128,7 +1128,7 @@ } }, _fireBeforeChangeEvent: function(attr, oldVal, newVal) { - this._fire(BEFORE + Kinetic.Util._capitalize(attr) + CHANGE, { + this._fire([BEFORE, Kinetic.Util._capitalize(attr), CHANGE].join(EMPTY_STRING), { oldVal: oldVal, newVal: newVal }); @@ -1171,7 +1171,8 @@ var oldVal; if(val !== undefined) { oldVal = this.attrs[key]; - this._fireBeforeChangeEvent(key, oldVal, val); + // NOTE: before events removed to improve performance + //this._fireBeforeChangeEvent(key, oldVal, val); this.attrs[key] = val; this._fireChangeEvent(key, oldVal, val); } diff --git a/test/performance/common/random-squares.js b/test/performance/common/random-squares.js index 378f6fa9..8441fd22 100644 --- a/test/performance/common/random-squares.js +++ b/test/performance/common/random-squares.js @@ -66,7 +66,7 @@ for (var i = 0; i < circles.length; i++) { var x = Math.random() * width; var y = Math.random() * height; - circles[i].setPosition(x, y); + circles[i].setPosition({x: x, y: y}); } lastTime = time; diff --git a/test/performance/random-squares-dev.html b/test/performance/random-squares-dev.html new file mode 100644 index 00000000..765fe416 --- /dev/null +++ b/test/performance/random-squares-dev.html @@ -0,0 +1,23 @@ + + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/test/performance/random-squares-v4.7.4.html b/test/performance/random-squares-v4.7.4.html index d6241516..2b1acaf1 100644 --- a/test/performance/random-squares-v4.7.4.html +++ b/test/performance/random-squares-v4.7.4.html @@ -14,8 +14,7 @@
- - +