Multiple ideas for reducing binary size
A few people have tried to remove unused crate features etc in the project. Let's have a thread that collects all of what we've tried and what we still want to try. Help is wanted on this one, but we still have to discuss the improvements individually and whether they are worth it.
- [x] there is a single release zip. a user has to download all installers for all platforms just to run one. -- fixed with https://github.com/EFForg/rayhunter/pull/442
- [x] the installer pulls in too many features and dependencies -- fixed with https://github.com/EFForg/rayhunter/pull/436
- adb_client is allegedly the biggest dependency, but i don't know enough about it
- @oopsbagel says they're going to make an upstream PR to be able to disable unused code ("Image formats") in adb_client.
- we use axum in exactly one place (tplink installer), maybe we can get away with something lighter.
- if we do this we should consider doing the same in the daemon, to keep the tech stack similar
- reqwest is going to be very heavy (#429), but i don't see a way out of this one
- could we remove tokio entirely from the installer? how about the daemon?
- if we stick with tokio, we should try to get rid of all
spawn_blockingin the daemon. we currently use it in display code, and it's not necessary. if we can get rid of all, we could switch to single-threaded runtime and save a tokio feature.
- if we stick with tokio, we should try to get rid of all
- adb_client is allegedly the biggest dependency, but i don't know enough about it
- [x] web frontend is bloated -- fixed with https://github.com/EFForg/rayhunter/pull/435
- sveltekit is unable to compress into one artifact, maybe move away from it to plain svelte + (random build tool)? (https://github.com/EFForg/rayhunter/pull/344#issue-3089511703)
- we should make one JS file, one CSS file, and compress them before including them into the daemon binary. if we send the compressed artifact to the browser as-is, we do not have to bundle a gzip library.
-
memory_servecrate does something like this but also forcibly includes a brotli decompressor into the binary, which offsets all benefits (I've tried) - i think we'd have to make our own buildscript/proc-macro to realize this
-
- [ ] orca.gif is bloated
- https://github.com/EFForg/rayhunter/pull/344#discussion_r2109737133
PRs done so far
- https://github.com/EFForg/rayhunter/pull/122
- https://github.com/EFForg/rayhunter/pull/235
- https://github.com/EFForg/rayhunter/pull/348
- https://github.com/EFForg/rayhunter/pull/436
- https://github.com/EFForg/rayhunter/pull/434
- https://github.com/EFForg/rayhunter/pull/440
- TODO: there are more than these
adb_client uses the image crate with no-default-features since May, we should try to get out adb_client changes upstreamed
Forgive me if this is obvious or I'm missing something but just looking at the UI code, the rayhunter_icon.png is a magnitude bigger than it's fellow assets, doesn't appear to actually be used anywhere in the UI and is still being included in the bundle.
Can that image just be removed?
@bsickler i think you're right, it's entirely unused. don't know when that happened. feel free to file a PR. at least the route can be removed in rust.