Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scristobal/load-imagedata-with-rust-and-web-assembly
https://github.com/scristobal/load-imagedata-with-rust-and-web-assembly
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/scristobal/load-imagedata-with-rust-and-web-assembly
- Owner: scristobal
- Created: 2024-10-06T13:44:35.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-20T18:06:21.000Z (18 days ago)
- Last Synced: 2024-10-22T07:40:14.957Z (17 days ago)
- Language: JavaScript
- Size: 83.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Load ImageData with Wasm (Rust)
A quick experiment to get raw pixels of a PNG using Wasm from Rust __no canvas involved__, compared to the more mainstream [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) and [WebGL2 API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) methods.
```
Running on Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0Benchmarking getImageDataUsingWebAssembly
decode 104327 bytes took 6.000 ms
decode 207071 bytes took 7.000 ms
decode 503111 bytes took 11.000 ms
decode 1068158 bytes took 16.000 ms
decode 3124201 bytes took 49.000 ms
decode 5249494 bytes took 45.000 ms
decode 10473459 bytes took 117.000 ms
decode 21141605 bytes took 233.000 ms
decode 32916531 bytes took 334.000 ms
Total time for getImageDataUsingWebAssembly is 818.000 msBenchmarking getImageDataUsingWebgl
decode 104327 bytes took 91.000 ms
decode 207071 bytes took 60.000 ms
decode 503111 bytes took 71.000 ms
decode 1068158 bytes took 72.000 ms
decode 3124201 bytes took 112.000 ms
decode 5249494 bytes took 106.000 ms
decode 10473459 bytes took 181.000 ms
decode 21141605 bytes took 329.000 ms
decode 32916531 bytes took 491.000 ms
Total time for getImageDataUsingWebgl is 1513.000 msBenchmarking getImageDataUsingOfflineCanvas
decode 104327 bytes took 22.000 ms
decode 207071 bytes took 6.000 ms
decode 503111 bytes took 11.000 ms
decode 1068158 bytes took 15.000 ms
decode 3124201 bytes took 55.000 ms
decode 5249494 bytes took 84.000 ms
decode 10473459 bytes took 137.000 ms
decode 21141605 bytes took 276.000 ms
decode 32916531 bytes took 520.000 ms
Total time for getImageDataUsingOfflineCanvas is 1126.000 ms
```