
Photon: High Performance Image Processing in WebAssembly / Rust - ArtWomb
https://silvia-odwyer.github.io/photon/
======
mratsim
Very nice website, it's very well done.

Regarding performance, I don't see what makes this high-performance. I looked
into the code for filters and it's a very naive translation of the algorithms.

Naive not in the pejorative way, you can only do so much on images stored as
contiguous RGB (arrays of struct), even OpenCV does not really optimize for
this.

Non-naive implementations of filters would use tiling, register blocking,
register rotation to avoid being bottlenecked by memory which is the main
issue with stencil code. I don't think vectorization is straightforward with
the RGB layout since you would need both scatter and gather instructions but
gather requires AVX2 and scatter is very manual.

Anyway the benchmark should use a reference C or C++ library or even imageflow
that is also written in Rust
[https://github.com/imazen/imageflow](https://github.com/imazen/imageflow).
Bonus point if you benchmark against Halide ([https://halide-
lang.org/](https://halide-lang.org/)) or Taichi
([http://taichi.graphics/](http://taichi.graphics/)) and you're only 20 times
slower (see their box blur example:
[https://github.com/halide/Halide/blob/master/apps/blur/halid...](https://github.com/halide/Halide/blob/master/apps/blur/halide_blur_generator.cpp))

------
jzoch
Great website. Really love the examples and style in general. I may be doing
something wrong but the "start JS" and "Start WASM" demo seems to 1) take
longer on wasm most of the time on my machine (latest firefox on latest mac
os) and 2) is a little clunky in how the two impls start and stop

------
smcnally
Looks good. Will check out your transforms first.

Fwiw, Automattic’s image optimizer / CDN for WordPress is also called Photon:

[https://developer.wordpress.com/docs/photon/api/](https://developer.wordpress.com/docs/photon/api/)

------
stanfordkid
Wow. Pretty cool. Agree that it doesn't compare to high-performance native
libs, but still a huge step up for the web and very professionally packaged!

