diff options
author | Jonathan Schwender <55576758+jschwe@users.noreply.github.com> | 2024-11-21 12:28:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 11:28:15 +0000 |
commit | 80529ef3588a0e7cf32e9783d5cd671118627ec7 (patch) | |
tree | 485a0f1f7d0846f9465b363b6e3bf908cc629aac | |
parent | 527e2d426d1101b281e5b30b870859d44425465a (diff) | |
download | servo-80529ef3588a0e7cf32e9783d5cd671118627ec7.tar.gz servo-80529ef3588a0e7cf32e9783d5cd671118627ec7.zip |
Add `medium` profile for daily work scenario (#34035)
- The standard `dev` mode is often too slow for daily work on servo
- Increasing the optimization level to 2 improves the performance noticably.
- Build time for opt-level = 1 is slightly higher than 2 on my machine
- Reducing debug info to `line-tables-only` improves link and build times,
while still keeping relevant info for backtraces.
Also extend .servobuild to allow setting custom cargo profiles instead
of just release and dev.
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | python/servo/command_base.py | 4 | ||||
-rw-r--r-- | servobuild.example | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml index 1ebcc8c9906..80f2d0d203d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,6 +162,14 @@ xml5ever = "0.20" opt-level = 3 debug-assertions = true +# A profile between `dev` and `release` which aims to offer a compromise between +# fast incremental rebuilds and runtime speed. +[profile.medium] +inherits = "release" +opt-level = 2 +incremental = true +debug = "line-tables-only" + [profile.production] inherits = "release" debug-assertions = false diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 1dcfe1e8408..1f8b6818c22 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -678,6 +678,10 @@ class CommandBase(object): elif self.config["build"]["mode"] == "release": print("No build type specified, but .servobuild specified `--release`.") return BuildType.release() + elif self.config["build"]["mode"] != "": + profile = self.config["build"]["mode"] + print(f"No build type specified, but .servobuild specified custom profile `{profile}`.") + return BuildType.custom(profile) else: print("No build type specified so assuming `--dev`.") return BuildType.dev() diff --git a/servobuild.example b/servobuild.example index bc8219b6673..40dd62e2421 100644 --- a/servobuild.example +++ b/servobuild.example @@ -14,6 +14,8 @@ [build] # Set "mode = dev" or use `mach build --dev` to build the project with warning. # or Set "mode = release" or use `mach build --release` for optimized build. +# Use `mode = <profile>` or `mach build --profile=<profile>` to build the given +# profile. Check the `Cargo.toml` manifest for a complete list of custom profiles. # Defaults to prompting before building #mode = "dev" |