Rewrite Rust components in C (yes, seriously.)

(#996) Feature Declined meta performance

Thread

Comment by @oax90
RexSystem 1 vote originally by @oax90 on GitHub 4 replies
Right now in the refactor branch Rust is used only in the client for a simple purpose. Is there really a need to keep dependency on Rust for that? I rather keep it full TS or use Go or C.
pub use animation::is_animated_image;
pub use apng::crop_and_rotate_apng;
pub use gateway::decompress_zstd_frame;
pub use gif::crop_and_rotate_gif;
pub use static_image::crop_and_rotate_image;
Comment by @zleepyzeezee
RexSystem 1 vote originally by @zleepyzeezee on GitHub OP
So simple I think TS could do it without much of a hit to performance either XD
Comment by @Speykious
RexSystem 1 vote originally by @Speykious on GitHub
Image decoding and processing is a quite resource-intensive task, so it makes sense to dedicate that to a lower level language. Given that it all needs to run on the browser, it has to be compiled in WASM, and Rust is kind of the best tool for that job. C could also do that job, just not as well.
Comment by @ctudor0
RexSystem 1 vote originally by @ctudor0 on GitHub
What do you mean not as well? You gotta be kidding. All image manipulation libraries are C. Both C and C++ can be compiled to WASM without any problem. Same goes for Go here. Don't act like Rust is the only thing that compiles to WASM.
Comment by @Speykious
RexSystem 1 vote originally by @Speykious on GitHub
No, I'm not kidding. Rust is by far the best language when it comes to targeting WASM. It is extremely straightforward to just make something compile to WASM in Rust. The same cannot be said about C which doesn't even have a package manager or standard build system. You can get away with a lot by doing unity builds of course, and it probably wouldn't even be that bad if set up correctly, but let's not pretend it's better than Rust for the task.