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

Array vs Float32Array: Performance measurements (again) #465

Open
psnet opened this issue Mar 16, 2024 · 1 comment
Open

Array vs Float32Array: Performance measurements (again) #465

psnet opened this issue Mar 16, 2024 · 1 comment

Comments

@psnet
Copy link

psnet commented Mar 16, 2024

TL;DR

Float32Array is faster for IO operations than usual Array. Only creation of new objects is slower for Float32Array.

Measurements

I saw issues there about complains of performance and I did recent clean and exact measurements about casual Array vs Float32Array:

https://www.measurethat.net/Benchmarks/Show/30129/3/array-vs-float32array-performance-test

And IO operations with Float32Array are 2x FASTER than usual Array. Array wins only in creation of new objects (arrays). But if we create needed data (preallocated) before main render loop (cycle) then Float32Array is big win.

Summary

So I want to say author should not remove support of Float32Array and still use approach available now: default is Float32Array but you can change it by method glMatrix.setMatrixArrayType(Array)

@snowfrogdev
Copy link

TL;DR

Float32Array is faster for IO operations than usual Array. Only creation of new objects is slower for Float32Array.

Measurements

I saw issues there about complains of performance and I did recent clean and exact measurements about casual Array vs Float32Array:

https://www.measurethat.net/Benchmarks/Show/30129/3/array-vs-float32array-performance-test

And IO operations with Float32Array are 2x FASTER than usual Array. Array wins only in creation of new objects (arrays). But if we create needed data (preallocated) before main render loop (cycle) then Float32Array is big win.

Summary

So I want to say author should not remove support of Float32Array and still use approach available now: default is Float32Array but you can change it by method glMatrix.setMatrixArrayType(Array)

When I run your benchmark suite on my computer (Windows - Chrome 129) the Array beats the TypedArray in all tests except for sort.

image

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

No branches or pull requests

2 participants