gskinner/EaselJS — Issue #113: new MouseEvent performance
Author: CharlesWall
Created: 2012-02-20 14:59:04+00:00
State: open

Could we utilize an object pool instead of creating an infinite amount of these. Theoretically you could just have one and mark it as expired. In this way the event doesn't have to be recreated each move and its lifecycle is limited to the stack consequent to calling onMouseMove.

Stage.js - 378:

var evt = new MouseEvent("onMouseMove", this.mouseX, this.mouseY, this, e);
//evt = mouseEventPool.getEvent("onMouseMove", this.mouseX, this.mouseY, this, e);

if (this.onMouseMove) { this.onMouseMove(evt); }
if (this._activeMouseEvent && this._activeMouseEvent.onMouseMove) { this._activeMouseEvent.onMouseMove(evt); }
//evt.expire()