Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to increase iteration speed? #638

Open
yay opened this issue Nov 26, 2020 · 15 comments
Open

Any way to increase iteration speed? #638

yay opened this issue Nov 26, 2020 · 15 comments
Labels
developer experience help wanted Extra attention is needed question Further information is requested

Comments

@yay
Copy link

yay commented Nov 26, 2020

Hello, I'm playing with the basic examples, like a single button changing the window title on click. But every time I run the app after making a change to the title string it takes a little over 10 seconds to recompile (on a 16" i9 MBP).

This is really disappointing coming from both web apps and native apps (Swift/SwiftUI, Delphi/VCL or C++/Qt based). At least when we are talking about basic apps like this.

Any way to improve this? I know the native frameworks I mentioned use dynamic libraries for the framework code while Rust has to recompile from source, but I'm really wondering about solutions rather than reasons for slow compile times.

I'm using the recently released iced 0.2 and Rust 1.48 on macOS 11.1

@yaskhan
Copy link

yaskhan commented Nov 27, 2020

Maybe ramdisk will help you?

@manokara
Copy link

It's true that Rust has a slow compile time for several reasons, but 10 seconds for that is way too much. I'm suspicious it could be a hardware issue (from what I gathered, not sure if the 16" model has the same issue) as my air-cooled Ryzen 5 2400G recompiles my quite substantial hexview demo in half that time when changing a couple lines, sometimes even a little bit less.

But there's a way to reduce compile times a little bit, described here. Might be worth a try.

@yay
Copy link
Author

yay commented Nov 28, 2020

I don't believe it's thermals related, the 16" model has a redesigned body with much larger air intakes and bigger fans to improve airflow. But it shouldn't make a difference either way compiling what is essentially a Hello World app from idle.

I don't believe it's IO bound either, I had a Ryzen 3900X PC with 1TB Evo 970 NVMe SSD that compiled our whole monorepo at the same speed (slightly slower actually, maybe because Windows...) as this laptop.

@alex13sh
Copy link

Use cargo build incremental
https://doc.rust-lang.org/cargo/reference/config.html

@hecrj hecrj added help wanted Extra attention is needed question Further information is requested labels Dec 1, 2020
@yay
Copy link
Author

yay commented Dec 2, 2020

Adding

[build]
incremental = true

to ./cargo/config.toml doesn't seem to do anything:
Screen Shot 2020-12-02 at 19 41

@manokara
Copy link

manokara commented Dec 2, 2020

That's because in debug builds incremental is enabled by default. Have you tried the linker approach I mentioned in my previous post? Still, I can't see a reason why an i9 would be slower than a 2nd gen Ryzen, even if it's a mobile chip. What could possibly be going on?

@yay
Copy link
Author

yay commented Dec 3, 2020

Thanks @manokara, I just tried that (was a bit busy at the time). With rustc 1.50 nightly and zld 1.2.1 the debug build now takes 6.29s, which is obviously a massive difference 👍, although I wouldn't mind improving it further :)

@yay
Copy link
Author

yay commented Dec 3, 2020

One thing I noticed is that after upgrading to macOS 11.0.1 VS Code got slower because of this issue: microsoft/vscode#105446 (comment)
I wonder if it plays a part here.

@cryptoquick
Copy link

These tweaks worked really well for me, check out the PR I referenced ☝️

@yay
Copy link
Author

yay commented Dec 13, 2020

Thanks @cryptoquick, they worked for me too, that's what I was referring to here: #638 (comment)
Although, as manokara suggested, there must be a reason why my builds are twice as slow even after tweaks on a seemingly comparable CPU (over 6 seconds vs under 3).

@cryptoquick
Copy link

cryptoquick commented Dec 13, 2020

@yay If you're currently using a Mac that costs less than $5000, you're almost definitely not using a comparable CPU. My CPU has a TDP of 105W. However, I also noticed that your build key recommendation seemed to be ignored in my screenshot, as I understand @manokara pointed out. Are you using zld, like the bevy instructions indicated? You also have to add the .cargo/config.toml, and be using nightly.

EDIT: I just read the comment you linked, haha, I'm tired. Yeah, that's what I did too, just with lld on my LInux desktop.

@yay
Copy link
Author

yay commented Dec 13, 2020

@cryptoquick Haha, no worries, sadly, I am using a MBP that is worth £4000 with i9-9980H inside. And reading tweets like this makes me think I'll have to upgrade next year: https://twitter.com/rikarends/status/1328598935380910082

@cryptoquick
Copy link

@yay Hold out for the M1X 😉

@yay
Copy link
Author

yay commented Apr 26, 2022

@cryptoquick I did :) and it's a big help! Now waiting for mold to come to macOS 😛

@13r0ck
Copy link
Member

13r0ck commented Apr 26, 2022

#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants