ec0eeaf69df7efbea07e64ceb82e7e4e9b751d4c
11
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3d4d8ef6a8 |
Remove unnecessary clone from Rope::append (#39960)
The previous code clones all the rope chunks, but the rope is passed by value so the chunks are about to be dropped anyhow. I thought this may slightly help performance but it has no very noticeable effect, with a mix of small changes up and down probably attributable to noise on my machine? I wonder if the benchmarks might just not hit this path well? I'm looking into that separately (see #39949, #39951), but this seemed clear enough to be worth proposing by itself. Incidentally it surprised me this did not generate a warning already, but I think it's because we're taking only one field from the struct that's about to be dropped: https://github.com/rust-lang/rust-clippy/issues/7429. <details> ``` Running benches/rope_benchmark.rs (target/release/deps/rope_benchmark-4c5c71666e7c1729) push/4096 time: [362.58 µs 366.40 µs 370.69 µs] thrpt: [10.538 MiB/s 10.661 MiB/s 10.773 MiB/s] change: time: [+0.0646% +1.2362% +2.4681%] (p = 0.04 < 0.05) thrpt: [-2.4086% -1.2211% -0.0646%] Change within noise threshold. Found 10 outliers among 100 measurements (10.00%) 7 (7.00%) high mild 3 (3.00%) high severe Benchmarking push/65536: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.4s, enable flat sampling, or reduce sample count to 50. push/65536 time: [1.6185 ms 1.6353 ms 1.6557 ms] thrpt: [37.747 MiB/s 38.219 MiB/s 38.616 MiB/s] change: time: [+1.9135% +2.9548% +3.9838%] (p = 0.00 < 0.05) thrpt: [-3.8312% -2.8700% -1.8776%] Performance has regressed. Found 6 outliers among 100 measurements (6.00%) 5 (5.00%) high mild 1 (1.00%) high severe append/4096 time: [1.1052 µs 1.1104 µs 1.1162 µs] thrpt: [3.4177 GiB/s 3.4354 GiB/s 3.4516 GiB/s] change: time: [-2.5075% -0.3430% +1.5095%] (p = 0.76 > 0.05) thrpt: [-1.4871% +0.3441% +2.5720%] No change in performance detected. Found 8 outliers among 100 measurements (8.00%) 7 (7.00%) high mild 1 (1.00%) high severe append/65536 time: [12.404 µs 12.444 µs 12.487 µs] thrpt: [4.8881 GiB/s 4.9049 GiB/s 4.9204 GiB/s] change: time: [-0.1408% +0.5573% +1.2016%] (p = 0.10 > 0.05) thrpt: [-1.1874% -0.5542% +0.1410%] No change in performance detected. Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) high mild 3 (3.00%) high severe slice/4096 time: [32.963 µs 33.185 µs 33.466 µs] thrpt: [116.72 MiB/s 117.71 MiB/s 118.51 MiB/s] change: time: [-6.4303% -5.1234% -3.6394%] (p = 0.00 < 0.05) thrpt: [+3.7769% +5.4000% +6.8722%] Performance has improved. Found 2 outliers among 100 measurements (2.00%) 1 (1.00%) high mild 1 (1.00%) high severe slice/65536 time: [668.67 µs 670.49 µs 672.65 µs] thrpt: [92.916 MiB/s 93.215 MiB/s 93.469 MiB/s] change: time: [+0.0846% +0.5573% +1.0199%] (p = 0.02 < 0.05) thrpt: [-1.0096% -0.5542% -0.0845%] Change within noise threshold. Found 10 outliers among 100 measurements (10.00%) 6 (6.00%) high mild 4 (4.00%) high severe bytes_in_range/4096 time: [5.1513 µs 5.1594 µs 5.1674 µs] thrpt: [755.95 MiB/s 757.12 MiB/s 758.31 MiB/s] change: time: [-4.9410% -4.2051% -3.3835%] (p = 0.00 < 0.05) thrpt: [+3.5020% +4.3897% +5.1978%] Performance has improved. Found 4 outliers among 100 measurements (4.00%) 1 (1.00%) low mild 3 (3.00%) high severe bytes_in_range/65536 time: [139.87 µs 140.17 µs 140.55 µs] thrpt: [444.67 MiB/s 445.89 MiB/s 446.85 MiB/s] change: time: [-0.6267% -0.0474% +0.4635%] (p = 0.87 > 0.05) thrpt: [-0.4614% +0.0475% +0.6306%] No change in performance detected. Found 9 outliers among 100 measurements (9.00%) 7 (7.00%) high mild 2 (2.00%) high severe chars/4096 time: [1.0243 µs 1.0250 µs 1.0257 µs] thrpt: [3.7190 GiB/s 3.7217 GiB/s 3.7243 GiB/s] change: time: [+4.0106% +4.5396% +5.3062%] (p = 0.00 < 0.05) thrpt: [-5.0388% -4.3425% -3.8559%] Performance has regressed. Found 10 outliers among 100 measurements (10.00%) 2 (2.00%) high mild 8 (8.00%) high severe chars/65536 time: [17.540 µs 17.576 µs 17.614 µs] thrpt: [3.4652 GiB/s 3.4727 GiB/s 3.4797 GiB/s] change: time: [+2.5201% +3.3922% +4.1639%] (p = 0.00 < 0.05) thrpt: [-3.9974% -3.2809% -2.4581%] Performance has regressed. Found 7 outliers among 100 measurements (7.00%) 4 (4.00%) high mild 3 (3.00%) high severe clip_point/4096 time: [58.857 µs 59.162 µs 59.490 µs] thrpt: [65.662 MiB/s 66.026 MiB/s 66.368 MiB/s] change: time: [+1.6900% +2.8088% +3.8521%] (p = 0.00 < 0.05) thrpt: [-3.7092% -2.7321% -1.6619%] Performance has regressed. Found 3 outliers among 100 measurements (3.00%) 3 (3.00%) high mild clip_point/65536 time: [1.8609 ms 1.8633 ms 1.8660 ms] thrpt: [33.494 MiB/s 33.543 MiB/s 33.585 MiB/s] change: time: [+0.0577% +0.2579% +0.4495%] (p = 0.01 < 0.05) thrpt: [-0.4474% -0.2572% -0.0577%] Change within noise threshold. Found 5 outliers among 100 measurements (5.00%) 3 (3.00%) high mild 2 (2.00%) high severe point_to_offset/4096 time: [19.246 µs 19.287 µs 19.331 µs] thrpt: [202.07 MiB/s 202.54 MiB/s 202.97 MiB/s] change: time: [+1.1073% +2.9754% +5.3818%] (p = 0.00 < 0.05) thrpt: [-5.1069% -2.8894% -1.0951%] Performance has regressed. Found 13 outliers among 100 measurements (13.00%) 5 (5.00%) high mild 8 (8.00%) high severe Benchmarking point_to_offset/65536: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.6s, enable flat sampling, or reduce sample count to 60. point_to_offset/65536 time: [741.87 µs 743.28 µs 744.74 µs] thrpt: [83.922 MiB/s 84.086 MiB/s 84.247 MiB/s] change: time: [+5.0577% +5.6751% +6.3133%] (p = 0.00 < 0.05) thrpt: [-5.9384% -5.3703% -4.8142%] Performance has regressed. Found 7 outliers among 100 measurements (7.00%) 4 (4.00%) high mild 3 (3.00%) high severe cursor/4096 time: [27.407 µs 27.483 µs 27.600 µs] thrpt: [141.53 MiB/s 142.13 MiB/s 142.53 MiB/s] change: time: [-7.1479% -6.2928% -5.6378%] (p = 0.00 < 0.05) thrpt: [+5.9747% +6.7154% +7.6981%] Performance has improved. Found 9 outliers among 100 measurements (9.00%) 1 (1.00%) high mild 8 (8.00%) high severe cursor/65536 time: [848.91 µs 849.70 µs 850.59 µs] thrpt: [73.478 MiB/s 73.555 MiB/s 73.624 MiB/s] change: time: [+0.0281% +0.3487% +0.6686%] (p = 0.04 < 0.05) thrpt: [-0.6642% -0.3475% -0.0281%] Change within noise threshold. Found 9 outliers among 100 measurements (9.00%) 5 (5.00%) high mild 4 (4.00%) high severe ``` </details> Release Notes: - N/A |
||
|
|
5b0a2f1ab6 |
Add more unit tests for Rope (#39426)
I was looking at the rope implementation and some of the existing bugs that crash in there, and I ran cargo-mutants to inspect test coverage. I was motivated by bugs like https://github.com/zed-industries/zed/issues/38556 but this doesn't fix it and the bug may well be at a higher layer. This PR adds coverage for a few functions that aren't tested today. I didn't find any actual bugs yet. I can see this tree is pretty sparse on docstrings so if you think these are too verbose I can take them out or drop the whole PR. Release Notes: - N/A |
||
|
|
d6fcd404af |
Show config messages from install-wild, install-mold (#38979)
Follows on from https://github.com/zed-industries/zed/pull/37717#discussion_r2376739687 @dvdsk suggested this but I didn't get to it in the previous PR. # Tested ``` ; sudo rm /usr/local/bin/wild ; ./script/install-wild Downloading from https://github.com/davidlattimore/wild/releases/download/0.6.0/wild-linker-0.6.0-x86_64-unknown-linux-gnu.tar.gz Wild is installed to /usr/local/bin/wild To make it your default, add or merge these lines into your ~/.cargo/config.toml: [target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=--ld-path=wild"] [target.aarch64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=--ld-path=wild"] ``` ``` ; sudo rm /usr/local/bin/mold ; ./script/install-mold 2.34.0 Downloading from https://github.com/rui314/mold/releases/download/v2.34.0/mold-2.34.0-x86_64-linux.tar.gz Mold is installed to /usr/local/bin/mold To make it your default, add or merge these lines into your ~/.cargo/config.toml: [target.'cfg(target_os = "linux")'] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=mold"] ``` Release Notes: - N/A |
||
|
|
d5aa81a5b2 |
Fix up Wild package name and decompression (#38961)
Wild changed in 0.6.0 to using gzip rather than xz, and changed the format of the package name. Follows on from and fixes https://github.com/zed-industries/zed/pull/37717 cc @dvdsk @mati865 Release Notes: - N/A |
||
|
|
10b99c6f55 |
RFC: Recommend and enable using Wild rather than Mold on Linux for local builds (#37717)
# Summary Today, Zed uses Mold on Linux, but Wild can be significantly faster. On my machine, Wild is 14% faster at a whole-tree clean build, 20% faster on an incremental build with a minimal change, and makes no measurable effect on runtime performance of tests. However, Wild's page says it's not yet ready for production, so it seems to early to switch for production and CI builds. This PR keeps using Mold in CI and lets developers choose in their own config what linker to use. (The downside of this is that after landing this change, developers will have to do some local config or it will fall back to the default linker which may be slower.) [Wild 0.6 is out, and their announcement has some benchmarks](https://davidlattimore.github.io/posts/2025/09/23/wild-update-0.6.0.html). cc @davidlattimore from Wild, just fyi # Tasks - [x] Measure Wild build, incremental build, and runtime performance in different scenarios - [x] Remove the Linux linker config from `.cargo/config.toml` in the tree - [x] Test rope benchmarks etc - [x] Set the linker to Mold in CI - [x] Add instructions to use Wild or Mold into `linux.md` - [x] Add a script to download Wild - [x] Measure binary size - [x] Recommend Wild from `scripts/linux` # Benchmarks | | wild 0.6 (rust 1.89) | mold 2.37.1 (1.89) | lld (rust 1.90) | wild advantage | | -- | -- | -- | -- | -- | | clean workspace build | 176s | 184s | 182s | 5% faster than mold | | nextest run workspace after build | 137s | 142s | 137s | in the noise? | | incremental rebuild | 3.9s | 5.0s | 6.6s | 22% faster than mold | I didn't observe any apparent significant change in runtime performance or binary size, or in the in-tree microbenchmarks. Release Notes: - N/A --------- Co-authored-by: Mateusz Mikuła <oss@mateuszmikula.dev> |
||
|
|
256a91019a |
ci: Move doctests to a separate parallel job (#38111)
Follow on from #37851 This may reduce CI time by running doctests in parallel with other tests. It also makes it easier to find the results. Example output: https://github.com/zed-industries/zed/actions/runs/17698218116/job/50300398669?pr=38111 At least on this run, the doctests finished before the main Linux tests, which makes sense because there are many fewer doctests. So they should not be on the critical path. Thanks @maxdeviant for the prompt. <img width="615" height="513" alt="image" src="https://github.com/user-attachments/assets/bcafa636-a68c-4602-97f4-61f7904e6a7b" /> Release Notes: - N/A |
||
|
|
b9cf5886e4 |
Run doctests in CI and fix up existing doctests (#37851)
Follows on from https://github.com/zed-industries/zed/pull/37716#pullrequestreview-3195695110 by @SomeoneToIgnore After this the doctests will be run in CI to check that the examples are still accurate. Note that doctests aren't run by Nextest: you can run them locally with `cargo test --doc`. Summary: * Run tests from CI * Loosen an exact float comparison to match approximately (otherwise it fails) * Fixed one actual bug in the tests for `dilate` where the test code assumed that `dilate` mutates `self` rather than returning a new object * Add some `must_use` on some functions that seemed at risk of similar bugs, following the Rust stdlib style to add it where ignoring the result is almost certainly a bug. * Fix some cases where the doc examples seem to have gone out of date with the code * Add imports to doctests that need them * Add some dev-dependencies to make the tests build * Fix the `key_dispatch` module docstring, which was accidentally attached to objects within that module * Skip some doctest examples that seem like they need an async environment or that just looked hard to get running AI usage: I asked Claude to do some of the repetitive tests. I checked the output and fixed up some things that seemed to not be in the right spirit of the test, or too longwinded. I think we could reasonably run the tests on only Linux to save CI CPU-seconds and latency, but I haven't done that yet, partly because of how it's implemented in the action. Release Notes: - N/A |
||
|
|
46aa05e240 |
Fix regex syntax in matching os-release (#38010)
From https://github.com/zed-industries/zed/pull/37712#issuecomment-3281970712, thank you @zywo Release Notes: - N/A |
||
|
|
5a8603bebb |
Install mold from the OS on Debian 13 (Trixie) (#37712)
I ran `scripts/linux` on Debian Trixie 13. It suggested manually installing Mold, but [mold](http://packages.debian.org/mold) is packaged on Debian and so we could install it automatically. The version packaged there seems to work well enough for `cargo t` to pass, at least. ## Tested ``` ; sudo apt remove mold libstdc++-14-dev ... uninstalls them ; ./script/linux The following NEW packages will be installed: build-essential clang clang-19 clang-tools-19 g++ g++-14 g++-14-x86-64-linux-gnu g++-x86-64-linux-gnu libstdc++-14-dev mold ; cargo t (passes) ``` Release Notes: - N/A |
||
|
|
abac87c2f8 |
tests: Fix doctests in crates/component (#37716)
Previously, `cargo test --package component` failed due to missing
imports for a doctest:
```
Doc-tests component
running 1 test
test crates/component/src/component.rs - Component::description (line 229) ... FAILED
failures:
---- crates/component/src/component.rs - Component::description (line 229) stdout ----
error: cannot find derive macro `Documented` in this scope
--> crates/component/src/component.rs:231:10
|
4 | #[derive(Documented)]
| ^^^^^^^^^^
error[E0599]: no associated item named `DOCS` found for struct `MyComponent` in the current scope
--> crates/component/src/component.rs:236:20
|
5 | struct MyComponent;
| ------------------ associated item `DOCS` not found for this struct
...
9 | Some(Self::DOCS)
| ^^^^ associated item not found in `MyComponent`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0599`.
Couldn't compile the test.
failures:
crates/component/src/component.rs - Component::description (line 229)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.29s
error: doctest failed, to rerun pass `-p component --doc`
bobcat ~/src/zed (doctests) 18:33
```
This might be unnoticed if you mostly run nextest, as it does not run
doctests.
Release Notes:
- N/A
|
||
|
|
52770cd3ad |
docs: Fix the database path on Linux (and BSD) (#32072)
Updated to reflect the logic in https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs. Release Notes: - N/A |