
Originally Posted by
mitchellsimoens
I would have to agree although I wouldn't expect too big of performance bump. Every little bit counts though I guess

The getBBox method could be optimized further by assigning Max.min and Math.max to a local variable. This would reduce scope traversal.
The bold vars are not used.
I like that you can exclude sprites from BBox calculations. This was added in B3.
var max = Math.max
Code:
getBBox: function() {
var i = 0,
sprite,
bb,
items = this.items,
len = this.length,
infinity = Infinity,
minX = infinity,
maxHeight = -infinity,
minY = infinity,
maxWidth = -infinity,
maxWidthBBox, maxHeightBBox;
for (; i < len; i++) {
sprite = items[i];
if (sprite.el && ! sprite.bboxExcluded) {
bb = sprite.getBBox();
minX = Math.min(minX, bb.x);
minY = Math.min(minY, bb.y);
maxHeight = Math.max(maxHeight, bb.height + bb.y);
maxWidth = Math.max(maxWidth, bb.width + bb.x);
}
}
return {
x: minX,
y: minY,
height: maxHeight - minY,
width: maxWidth - minX
};
}