-
Notifications
You must be signed in to change notification settings - Fork 178
Open
Description
Steps:
- Rename
xilemtoxilem-internal - Create
xilemwithpub use xilem_internal::*;. - Create
xilem-dylibwith[lib] crate-type = ["dylib"]inCargo.tomlanduse xilem_internal;inlib.rs. - Add a feature to
xilemto enable thexilem-dylibdependency anduse xilem_dylib;.
This can also be made work without creating a new xilem-internal package by making package consumers add use xilem_dylib; themselves.
This makes the program depend on Xilem via a dynamic library instead of statically linking:
$ ldd target/debug/myapp | rg xilem
libxilem_dylib.so => not found
$ du -sh target/debug/myapp target/debug/libxilem_dylib.so
41M target/debug/myapp
338M target/debug/libxilem_dylib.soFor me, this reduced incremental compilation times (simple app) from ~1.75s to ~0.95s. That's -45%.
Dynamically linking dioxus-devtools and winit over made the incremental compilation time drop further down to 0.87s and produced this:
$ ldd target/debug/myapp | rg xilem
libxilem_dylib.so => not found
$ du -sh target/debug/myapp target/debug/libxilem_dylib.so
26M target/debug/myapp
358M target/debug/libxilem_dylib.soWithout dynamic linking, the linker can remove more unused code and perform other optimizations.
$ ldd target/debug/myapp | rg xilem
libxilem_dylib.so => not found
$ du -sh target/debug/myapp
317M target/debug/myappReferences:
jakobhellermann, Master-Hash and theoparis
Metadata
Metadata
Assignees
Labels
No labels