dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Remove NASM CLI requirement

Open ealmloff opened this issue 1 year ago • 3 comments

Specific Demand

Dx now optimizes images including avif images. Dx supports avif images because it is the most well supported small format that browsers support. To encode avif images, dioxus uses the image crate (https://github.com/image-rs/image/issues/1404) which in turn uses rav1e (https://lib.rs/crates/rav1e#readme-dependency-nasm) and relies on NASM on some platforms.

Implement Suggestion

Find another crate that supports avif encoding in rust without NASM or disable the NASM feature on rav1e and create our own bindings to the image crate

ealmloff avatar Jan 13 '24 15:01 ealmloff

I was able to install NASM via winget, but I had to manually add the path to my env.

Disabling rav1e's asm feature by default, with an optional asm feature to re-enable it should work.

ShayBox avatar Jan 22 '24 01:01 ShayBox

Perhaps this could be a plugin instead of a direct part of the CLI?

DogeDark avatar Jan 28 '24 00:01 DogeDark

Perhaps this could be a plugin instead of a direct part of the CLI?

It could be a plugin, but you would sacrifice a lot of performance. WASM is pretty fast, but it is still ~1/2 the speed of native code. For most plugins this doesn't matter too much, but asset optimization can be compute intensive. I think we can remove the feature on rav1e that enables nasm and still be much faster than a WASM plugin.

ealmloff avatar Jan 28 '24 02:01 ealmloff

This is fixed on MacOs and Linux but it looks like rav1e is still pulling in nasm on windows even without the asm feature enabled

ealmloff avatar Mar 13 '24 17:03 ealmloff

Windows is fixed as well. I was running into a different caching issue with CI

ealmloff avatar Mar 13 '24 19:03 ealmloff