I was wondering if you were considering making a WebAssembly (WASM) version of your library.
WebAssembly has been in Node since version 8. Your code could run substantially faster if ported to WASM and it would be compatible with all LTS versions of Node
Just a suggestion that could help improve your library.
👍
I would recommend porting the code to assemblyscript for this feature.
WHOOPS i started working on implementing this.
Why should a WASM version be significantly faster, than the JavaScript version? Just for context, have a look at: https://colineberhardt.github.io/wasm-mandelbrot/#WebAssembly
Compare the JS version of the Mandelbrot to the AssemblyScript one:
_Simply_ translating code to assemblyscript will not likely give you a speed boost. While assemblyscript claims to have a _optimized native Math implementation_ I could not find any real world numbers.
I do not want to discourage you, but I really doubt your initial statement:
Your code could run substantially faster if ported to WASM
For context have a look at the following articles:
I've never really used wasm myself. but it seems like the best way to use wasm in jimp would either be through:
ImageMagick but sharp would probably be the one to do that. This could also get ridiculously large and not be suited for browsers anymore
@ChristianUlbrich yeah, i read the mandelbrot comparison when i was working on this, and the results i've found has concluded that there isn't a huge amount of speed boost. I'm not actively working on the PR, but it was still worth the investigation.
and now i've stumbled onto https://github.com/gpujs/gpu.js and i'm curious if that could give speedups...
Additionally, it looks like libvips has been ported to wasm, so that's a definite speedup if we can run things entirely inside of libvips, while preserving the jimp interface https://github.com/kleisauke/wasm-vips
Not quite WASM, but I've recently started a project that aims to implement many Jimp functions as a native C++ addon, it can greatly increase server-side image processing speed: https://github.com/sjoerd108/jimp-native
Nice!!!
On Sat, Jun 5, 2021, 1:21 PM Sjoerd @.*> wrote:
Not quite WASM, but I've recently started a project that aims to implement
many Jimp functions as a native C++ addon, it can greatly increase
server-side image processing: https://github.com/sjoerd108/jimp-native—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/oliver-moran/jimp/issues/833#issuecomment-855284356,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAMDVYMXX4PZRTE7SQDW4WLTRJ2NJANCNFSM4KAT67OQ
.
@sjoerd108 note that, if it's a naiive port, the wasm time and native times may be similar, as I observed here https://github.com/owldotco/damerau-levenshtein/pull/2
@forivall I'm aware, and I'm fairly certain a WASM port would get close to native speeds. I want to look into potentially reusing the C++ code written for jimp-native to help with a WASM version, but I haven't looked into it enough to say if that can work as I'm not very familiar with WASM.