You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to render thousands of tiles to the screen. I use a GraphicsGroup to "chunk" draw calls. If I profile a static scene, the JS heap will grow before performing a GC that impacts frame rate:
I did a memory allocation profile over 15 seconds, and get localBounds allocated about 60 MB.
Looking at that method, I notice a few allocations:
Is it possible to reduce the number of allocations of get localBounds by this.members.length by reusing bb in combine?
publicgetlocalBounds(): BoundingBox{letbb=newBoundingBox();for(constmemberofthis.members){if(memberinstanceofGraphic){member.localBounds.combine(bb,bb);// use bb as dest to avoid allocation}else{const{ graphic,offset: pos, useBounds }=member;constshouldUseBounds=useBounds===undefined ? true : useBounds;if(graphic){if(shouldUseBounds){graphic.localBounds.translate(pos).combine(bb,bb);// use bb as dest to avoid allocation}}else{this._logger.warnOnce(`Graphics group member has an null or undefined graphic, member definition: ${JSON.stringify(member)}.`);}}}returnbb;}
The text was updated successfully, but these errors were encountered:
Context
I am trying to render thousands of tiles to the screen. I use a
GraphicsGroup
to "chunk" draw calls. If I profile a static scene, the JS heap will grow before performing a GC that impacts frame rate:I did a memory allocation profile over 15 seconds, and
get localBounds
allocated about 60 MB.Looking at that method, I notice a few allocations:
let bb = new BoundingBox();
bb = member.localBounds.combine(bb);
bb = graphic.localBounds.translate(pos).combine(bb);
Proposal
Is it possible to reduce the number of allocations of
get localBounds
bythis.members.length
by reusingbb
incombine
?The text was updated successfully, but these errors were encountered: