Skip to content

Commit 2f24d17

Browse files
committed
Improve skinWasAltered performance
#15 TurboWarp/extensions#1153
1 parent 1ffefcf commit 2f24d17

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/RenderWebGL.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,10 @@ class RenderWebGL extends EventEmitter {
906906

907907
skinWasAltered (skin) {
908908
// This is very hot function.
909-
for (let i = 0; i < this._allDrawables.length; i++) {
910-
const drawable = this._allDrawables[i];
911-
if (drawable && drawable._skin === skin) {
909+
for (let i = 0; i < this._drawList.length; i++) {
910+
const drawableId = this._drawList[i];
911+
const drawable = this._allDrawables[drawableId];
912+
if (drawable._skin === skin) {
912913
drawable._skinWasAltered();
913914
}
914915
}

0 commit comments

Comments
 (0)