Open emilk opened 5 months ago
Compiling for Linux is also much slower. On my machine (Fedora 40, i7-1260P), cross-compiling eframe for macOS (with --target aarch64-apple-darwin
) takes 21s and for Windows (with --target x86_64-pc-windows-msvc
) takes 24s, while compiling for the default x86_64-unknown-linux-gnu
target takes 78s. With the wgpu feature, it goes up to 104s. I couldn't cross-compile to mac with wgpu because I got an error, and Windows with wgpu took 54s.
I created a draft PR here https://github.com/emilk/egui/pull/4834 so you can verify if it matches your expectations
I don't see a noticeable difference in the compile times though (for cargo clean && cargo build --timings -p eframe
)
eframe currently compiles in about 10s on my M3 MacBook Pro, as measured by
Getting rid of proc-macros
A lot of that time is waiting for
proc-macro
andsyn
so that we can start compilingbytemuck
,thiserror
, andforeign-types-macros
(used bycore-graphics
, which is used bywinit
).Getting rid of the proc-macros in
bytemuck
should be simple (replace by manual implementation of itsunsafe
traits forColor32
,Vertex
etc). Likewise, replacingthiserror
should also be fairly trivial.I haven't looked into
foreign-types
, but even removing some proc-macro usage should allow some crates to start compiling earlier, hopefully reducing the total end-to-end compilation time.Other stuff
ahash
has abuild.rs
takes a full second to runicrate
takes 5-6 seconds of CPU timewgpu
Switching
glow
forwgpu
adds another 10s, i.e. doubling the compilation time. To investigate the compilation time of wgpu, run: