-
Notifications
You must be signed in to change notification settings - Fork 1
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
Why is it slower than native sort on my system? #3
Comments
Thanks for sharing your results! Unfortunately your results make sense given what I've learned.
I planned on sorting generic Javascript arrays where the browser's native sort performs much worse. But unfortunately it wasn't viable due to the performance penalty incurred whilst casting numbers and strings to an ArrayBuffer. Maybe WASM can do that casting much faster? |
To pass data to WASM you have to cast them as well :-D I'm pretty sure that casting itself isn't a bottleneck. What could be an potential issue here is a way of handling serialization. |
Yeah looks like your right. It appears the only way to interact with WASM is through TypedArrays. I don't know why I was thinking it'd be like webworkers where you can shove pretty much anything through. |
Tests on Ryzen 2700U
Firefox 73, Linux x86_64, AMD RAVEN (DRM 3.36.0, 5.5.7-arch1-1, LLVM 9.0.1)
32,768
gpu.sort 29ms
gpu.sortAsync 36ms
Float64Array.sort 12ms
gpu.sort 91ms
gpu.sortAsync 98ms
Float64Array.sort 49ms
gpu.sort 263ms
gpu.sortAsync 368ms
Float64Array.sort 189ms
gpu.sort 1,049ms
gpu.sortAsync 2,366ms
Float64Array.sort 726ms
gpu.sort 4,811ms
gpu.sortAsync 10,116ms
Float64Array.sort 3,748ms
The text was updated successfully, but these errors were encountered: