Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizing performance of _BinaryWriter._resizeBuffer #13456

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

myfreeer
Copy link
Contributor

In class _BinaryWriter of the gltf exporter, a loop is used to copy contents in old buffer to new buffer, which is benchmarked to be slow. TypedArray.prototype.set() can be used for faster memory copying while having the same Browser compatibility of TypedArray.

Forum link:
https://forum.babylonjs.com/t/optimizing-performance-of-binarywriter-resizebuffer/37516

Benchmark before:
playground.babylonjs.com
image

Benchmark after:
playground.babylonjs.com
image

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 20, 2023

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 20, 2023

In class _BinaryWriter of the gltf exporter, a loop is used to copy contents in old buffer to new buffer, which is benchmarked to be slow.
TypedArray.prototype.set() can be used for faster memory copying while having the same Browser compatibility of TypedArray.

Forum link:
https://forum.babylonjs.com/t/optimizing-performance-of-binarywriter-resizebuffer/37516
@myfreeer myfreeer force-pushed the binary-writer-resize-buffer branch from 5ad54c3 to 5e8ad0b Compare January 20, 2023 02:56
@sebavan sebavan merged commit 2a62b1f into BabylonJS:master Jan 20, 2023
@myfreeer myfreeer deleted the binary-writer-resize-buffer branch January 21, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants