Skip to content

Added PooledBuffer to improve memory performance;Disable WebGL Blob to prevent listener multiple allocations#36

Merged
psygames merged 3 commits into
psygames:masterfrom
darklinden:master
Feb 21, 2025
Merged

Added PooledBuffer to improve memory performance;Disable WebGL Blob to prevent listener multiple allocations#36
psygames merged 3 commits into
psygames:masterfrom
darklinden:master

Conversation

@darklinden
Copy link
Copy Markdown
Contributor

  • Added PooledBuffer to improve memory performance
    添加buffer池优化内存性能

目前在Editor/WebGL版本使用Profiler测试,buffer池足够可用时收发消息GC.Alloc稳定为0

  • Disable WebGL Blob to prevent listener multiple allocations
    WebGL中修改 instance.ws.binaryType = 'arraybuffer';强制使用arraybuffer而不是Blob来规避每次收消息new FileReader设置listener

Chrome performance中会发现稳定的listener的增加和一段时间后GC, 暂时强制使用arraybuffer进行规避

我这使用Unity2021.3版本测试WebGL build, 即使Profiler中GC.Alloc为0, 在Chrome performance中测试每帧也会有1kb左右的内存申请, 使用空工程导出WebGL build同上,暂无法处理

@psygames psygames merged commit 4d382e6 into psygames:master Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants