tauri icon indicating copy to clipboard operation
tauri copied to clipboard

perf: remove lto setting from CLI

Open CrabNejonas opened this issue 1 year ago • 9 comments

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Docs
  • [ ] New Binding issue #___
  • [ ] Code style update
  • [ ] Refactor
  • [x] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change?

  • [ ] Yes, and the changes were approved in issue #___
  • [x] No

Checklist

  • [ ] When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • [ ] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • [x] I have added a convincing reason for adding this feature, if necessary

Other information

This PR removes the lto=true setting for the CLI. This drastically improves the install performance (the time it takes to run cargo install tauri-cli). Since the CLI is not doing performance-critical work and size is not important here since the cli will be compiled locally this does not have a downside it it afaik and only improves performance for rust users.

To give you an idea here are the install times on my MacBook Pro m2:

build time
with lto 2:55.31
without lto 1:05.46

so as you can see disabling lto reduced the compile-time by 3x.

CrabNejonas avatar May 04 '23 14:05 CrabNejonas

what do you think about moving the lto (and the new stuff you added in the js api) into a custom profile that inherits the release profile so that we can use that for the cargo-binstall CI?

FabianLars avatar May 04 '23 14:05 FabianLars

I had to use patch-package because napi-rs does not support custom profiles :(

lucasfernog avatar May 25 '23 22:05 lucasfernog

Also @JonasKruckenberg why did you target next here instead of dev?

lucasfernog avatar May 25 '23 22:05 lucasfernog

I had to use patch-package because napi-rs does not support custom profiles :(

I would probably look into upstreaming this to napi-rs, the maintainer is pretty responsive and would probably publish it soon after merging.

Also if I understand correctly, this change wants to improve cargo install tauri-cli which iirc will use release profile by default which doesn't have this change and users would need to cargo install tauri-cli --profile release-size-optimized which is bad DX

amrbashir avatar May 26 '23 00:05 amrbashir

He's focusing on v3 so I'm not sure if he wants to patch for v2. I'll try anyway.

lucasfernog avatar May 26 '23 00:05 lucasfernog

I had to use patch-package because napi-rs does not support custom profiles :(

I would probably look into upstreaming this to napi-rs, the maintainer is pretty responsive and would probably publish it soon after merging.

Also if I understand correctly, this change wants to improve cargo install tauri-cli which iirc will use release profile by default which doesn't have this change and users would need to cargo install tauri-cli --profile release-size-optimized which is bad DX

I think you misunderstood. We don't want users to use release-size-optimized, we want them to have faster builds. The size optimization will be used only on the cargo-binstall and NPM assets.

lucasfernog avatar May 26 '23 00:05 lucasfernog

ah right, I was even more confused by the name. LGTM then.

amrbashir avatar May 26 '23 00:05 amrbashir

@CrabNejonas we also need to rebase this branch with commit signing :cry:

lucasfernog avatar May 26 '23 16:05 lucasfernog

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

socket-security[bot] avatar May 27 '23 13:05 socket-security[bot]