-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
ArcStr
for marker values (#10453)
N.B. After fixing #10430, `ArcStr` became the fastest implementation (and the gains were significantly reduced, down to 1-2%). See: #10453 (comment). ## Summary I tried out a variety of small string crates, but `Arc<str>` outperformed them, giving a ~10% speed-up: ```console ❯ hyperfine "../arcstr lock" "../flexstr lock" "uv lock" "../arc lock" "../compact_str lock" --prepare "rm -f uv.lock" --min-runs 50 --warmup 20 Benchmark 1: ../arcstr lock Time (mean ± σ): 304.6 ms ± 2.3 ms [User: 302.9 ms, System: 117.8 ms] Range (min … max): 299.0 ms … 311.3 ms 50 runs Benchmark 2: ../flexstr lock Time (mean ± σ): 319.2 ms ± 1.7 ms [User: 317.7 ms, System: 118.2 ms] Range (min … max): 316.8 ms … 323.3 ms 50 runs Benchmark 3: uv lock Time (mean ± σ): 330.6 ms ± 1.5 ms [User: 328.1 ms, System: 139.3 ms] Range (min … max): 326.6 ms … 334.2 ms 50 runs Benchmark 4: ../arc lock Time (mean ± σ): 303.0 ms ± 1.2 ms [User: 301.6 ms, System: 118.4 ms] Range (min … max): 300.3 ms … 305.3 ms 50 runs Benchmark 5: ../compact_str lock Time (mean ± σ): 320.4 ms ± 2.0 ms [User: 318.7 ms, System: 120.8 ms] Range (min … max): 317.3 ms … 326.7 ms 50 runs Summary ../arc lock ran 1.01 ± 0.01 times faster than ../arcstr lock 1.05 ± 0.01 times faster than ../flexstr lock 1.06 ± 0.01 times faster than ../compact_str lock 1.09 ± 0.01 times faster than uv lock ```
- Loading branch information
1 parent
7a21b71
commit 8420195
Showing
12 changed files
with
80 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.