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

perf: experiment with immutable strings #302

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

perf: experiment with immutable strings #302

wants to merge 1 commit into from

Conversation

reubeno
Copy link
Owner

@reubeno reubeno commented Dec 30, 2024

No description provided.

Copy link

Test Results

    2 files      9 suites   1m 17s ⏱️
  569 tests   569 ✅ 0 💤 0 ❌
1 124 runs  1 124 ✅ 0 💤 0 ❌

Results for commit 03d57c7.

Copy link

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
expand_one_string 3.52 μs 3.51 μs -0.00 μs ⚪ Unchanged
for_loop 587665.96 μs 578031.33 μs -9634.63 μs 🟢 -1.64%
instantiate_shell 62.10 μs 62.03 μs -0.07 μs ⚪ Unchanged
instantiate_shell_with_init_scripts 28430.04 μs 29777.49 μs 1347.45 μs 🟠 +4.74%
parse_bash_completion 2806.87 μs 2661.94 μs -144.93 μs 🟢 -5.16%
parse_sample_script 4.26 μs 4.42 μs 0.16 μs 🟠 +3.68%
run_echo_builtin_command 92.11 μs 92.53 μs 0.43 μs ⚪ Unchanged
run_one_builtin_command 113.77 μs 110.22 μs -3.54 μs ⚪ Unchanged
run_one_external_command 1754.84 μs 1815.26 μs 60.41 μs 🟠 +3.44%
run_one_external_command_directly 826.52 μs 825.19 μs -1.33 μs ⚪ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-core/src/builtins/declare.rs 🟢 82.63% 🟢 82.83% 🟢 0.2%
brush-core/src/builtins/export.rs 🟠 74.07% 🟢 75.44% 🟢 1.37%
brush-core/src/builtins/unset.rs 🟢 85.11% 🟢 85.71% 🟢 0.6%
brush-core/src/completion.rs 🟠 63.1% 🟠 63.21% 🟢 0.11%
brush-core/src/expansion.rs 🟢 96.1% 🟢 96.13% 🟢 0.03%
brush-core/src/interp.rs 🟢 92.35% 🟢 92.36% 🟢 0.01%
brush-core/src/prompt.rs 🟢 90.38% 🟢 90.26% 🔴 -0.12%
brush-parser/src/ast.rs 🔴 25.35% 🔴 24.91% 🔴 -0.44%
brush-parser/src/tokenizer.rs 🟢 96.12% 🟢 96.28% 🟢 0.16%
Overall Coverage 🟢 77.34% 🟢 77.35% 🟢 0.01%

Minimum allowed coverage is 70%, this run produced 77.35%

@reubeno
Copy link
Owner Author

reubeno commented Dec 30, 2024

@39555 I'm interested to get your take since you've been looking at and thinking about parsing, tokenizing, and strings. Independent of parser approach (I.e. winnow/nom, peg, etc.), what do you think about looking at one of the many "low-cost clone" / CoW string crates? I encountered imstr but also see arcstr and a variety of others in similar category.

Given how much of the shell is string manipulation, I could see benefit but am concerned about how virally they spread in a code base and how much we'd get locked into them.

This draft is just an experiment in the parser crate. I imagine we'd see greater benefit by going more widespread and figuring out how to better work with them, where we can use the non-thread-safe variants, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant