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

Speed Up Compile Times #188

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "clang"
#rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]
rustflags = ["-Clink-arg=-fuse-ld=lld"]


# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
#[target.x86_64-apple-darwin]
#rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]

#[target.aarch64-apple-darwin]
#rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld", "-Zshare-generics=y"]
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
#rustflags = ["-Zshare-generics=n"]

[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
#[profile.dev]
#debug = 1
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: matrix.config.os == 'ubuntu-latest'
run: |
set -euxo pipefail
sudo apt update && sudo apt upgrade && sudo apt install -y lld g++ pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt update && sudo apt upgrade && sudo apt install -y mold g++ pkg-config libx11-dev libasound2-dev libudev-dev

- name: 🦀 Setup Rust
uses: actions-rs/toolchain@v1
Expand All @@ -48,7 +48,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.config.target }} --features storage --features cli --features arcade
args: --release --target ${{ matrix.config.target }} --no-default-features --features storage --features cli --features arcade

- name: Assume AWS IAM role
uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install bevy deps and binaryen for wasm optimization
run: |
set -euxo pipefail
sudo apt update && sudo apt upgrade && sudo apt install -y lld g++ pkg-config libx11-dev libasound2-dev libudev-dev binaryen
sudo apt update && sudo apt upgrade && sudo apt install -y mold g++ pkg-config libx11-dev libasound2-dev libudev-dev binaryen
- name: Build wasm assets
run: ./build_wasm.sh
- name: Publish deployment to netlify website
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.1"
edition = "2021"

[workspace]
resolver = "2"
members = [
"crates/thetawave_interface",
"crates/thetawave_storage",
Expand Down Expand Up @@ -111,6 +112,8 @@ opt-level = 1
codegen-units = 1

[features]
default = ["fast-compile", "storage"]
arcade = ["thetawave_arcade"]
storage = ["thetawave_storage"]
cli = ["argh"]
fast-compile = ["bevy/dynamic_linking"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fast-compile = ["bevy/dynamic_linking"]
dyn-bevy = ["bevy/dynamic_linking"]

2 changes: 1 addition & 1 deletion build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail
rm -rf ./out/
mkdir ./out
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown --no-default-features
cargo install wasm-bindgen-cli
wasm-bindgen --out-dir ./out/ --target web --split-linked-modules ./target/wasm32-unknown-unknown/release/thetawave.wasm
wasm-opt out/thetawave_bg.wasm -Oz -o thetawave_bg.wasm
Expand Down
Loading