Skip to content

fix(break,continue): use default_value_t for flag values#493

Merged
reubeno merged 1 commit into
reubeno:mainfrom
Elsie19:default-value-t
May 15, 2025
Merged

fix(break,continue): use default_value_t for flag values#493
reubeno merged 1 commit into
reubeno:mainfrom
Elsie19:default-value-t

Conversation

@Elsie19
Copy link
Copy Markdown
Contributor

@Elsie19 Elsie19 commented May 15, 2025

default_value is for types that can be converted into a String, which can be expensive, but default_value_t is for stack-allocated types and should be a less expensive to use.

At the level that you use default_value, it won't get us that much more performance, but it's still worth it.

#490 does the ones for mapfile.

Copy link
Copy Markdown
Owner

@reubeno reubeno left a comment

Choose a reason for hiding this comment

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

Nice! Righteous change.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2025

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
clone_shell_object 17.91 μs 18.26 μs 0.34 μs 🟠 +1.93%
eval_arithmetic 0.17 μs 0.17 μs 0.00 μs ⚪ Unchanged
expand_one_string 1.99 μs 1.82 μs -0.17 μs 🟢 -8.48%
for_loop 23.60 μs 22.62 μs -0.98 μs 🟢 -4.15%
function_call 2.95 μs 2.48 μs -0.47 μs 🟢 -15.92%
instantiate_shell 57.71 μs 58.83 μs 1.12 μs ⚪ Unchanged
instantiate_shell_with_init_scripts 26041.43 μs 24501.94 μs -1539.49 μs 🟢 -5.91%
parse_bash_completion 1713.17 μs 1663.81 μs -49.36 μs 🟢 -2.88%
parse_sample_script 1.73 μs 1.74 μs 0.01 μs ⚪ Unchanged
run_echo_builtin_command 15.65 μs 15.76 μs 0.10 μs ⚪ Unchanged
run_one_external_command 2114.40 μs 2357.40 μs 243.00 μs 🟠 +11.49%
tokenize_sample_script 2.92 μs 2.84 μs -0.08 μs ⚪ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-core/src/builtins/break_.rs 🟢 84.62% 🟢 85.71% 🟢 1.09%
brush-core/src/builtins/continue_.rs 🟢 93.33% 🟢 93.75% 🟢 0.42%
brush-core/src/jobs.rs 🔴 43.1% 🔴 37.07% 🔴 -6.03%
Overall Coverage 🟢 76.88% 🟢 76.81% 🔴 -0.07%

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

Test Summary: bash-completion test suite

Outcome Count Percentage
✅ Pass 1300 61.64
❗️ Error 230 10.91
❌ Fail 196 9.29
⏩ Skip 368 17.45
❎ Expected Fail 14 0.66
✔️ Unexpected Pass 1 0.05
📊 Total 2109 100.00

@reubeno reubeno merged commit b1edb8a into reubeno:main May 15, 2025
44 of 45 checks passed
@Elsie19 Elsie19 deleted the default-value-t branch May 16, 2025 20:13
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.

2 participants