This is an example given by Leaferjs, comparing the time required to create 1 million rectangles.
Konva takes the longest time to create 1 million rectangles, approximately over 40 seconds
Here is a Flame Graph created by Konva with 330000 rectangles, it can be seen that _getProtoListeners is called frequently
The culprit is that the absoluteTransformChange event is sent, because fire calls _getProtoListeners
_clearSelfAndDescendantCache(attr?: string) {
this._clearCache(attr);
// trigger clear cache, so transformer can use it
if (attr === ABSOLUTE_TRANSFORM) {
this.fire('absoluteTransformChange');
}
}
Is it possible to judge that if there is no Transformer, do not fire?
This is an example given by Leaferjs, comparing the time required to create 1 million rectangles. Konva takes the longest time to create 1 million rectangles, approximately over 40 seconds Here is a Flame Graph created by Konva with 330000 rectangles, it can be seen that
_getProtoListeners
is called frequentlyThe culprit is that the
absoluteTransformChange
event is sent, becausefire
calls_getProtoListeners
Is it possible to judge that if there is no Transformer, do not fire?