Conversation
9f9989d to
f11d4e6
Compare
77108f2 to
c9b81dc
Compare
Alonely0
left a comment
There was a problem hiding this comment.
Looks fine, but there are a lot of removed comments (vibecode?) and unnecessary performance hits.
| } | ||
|
|
||
| fn indicator_char(path: &PathData, style: IndicatorStyle) -> Option<char> { | ||
| let sym = classify_file(path); |
There was a problem hiding this comment.
The classify_files() function is now called unconditionally, but beforehand it was contingent on config.indicator_style != IndicatorStyle::None. I'm concerned this is going to negatively affect performance since it has to stat files. Maybe the best solution is to remove the IndicatorStyle::None branch and change all occurrences of IndicatorStyle to Option<IndicatorStyle>, then do a let-else.
There was a problem hiding this comment.
PD: please keep the old comments on the code you refactored to this new function. Did you vibecode this? Don't take it the wrong way; this is just a usual telltale.
| None => target_path.clone(), | ||
| } | ||
| } else { | ||
| target_path.clone() |
There was a problem hiding this comment.
Please do not clone here; it is not necessary. Use references, like the previous code that you have replaced. This was fixed in edfe26c.
| ), | ||
| ); | ||
| } else { | ||
| name.push(escaped_target); |
There was a problem hiding this comment.
Please keep comments. Previously in L804-805.
| false, | ||
| ); | ||
|
|
||
| let mut target_display = escaped_target.clone(); |
There was a problem hiding this comment.
Please do not clone here. You should refactor the immediate assignment inside the if to be the expression of the let definition, like let var = if ... { ... } else { ... };. Alternatively, use references or a Cow if you have to.
| false, | ||
| ); | ||
|
|
||
| // Check if the target actually needs coloring |
There was a problem hiding this comment.
Keep this comment if you can.
| ); | ||
|
|
||
| if style.is_some() { | ||
| // Only apply coloring if there's actually a style |
There was a problem hiding this comment.
Keep this comment if you can.
| is_wrap(name.len()), | ||
| )); | ||
| } else { | ||
| // For regular files with no coloring, just use plain text |
There was a problem hiding this comment.
Once/if you apply the other requested changes, consider keeping this comment.
|
GNU testsuite comparison: |
Merging this PR will degrade performance by 4.83%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | ls_recursive_balanced_tree[(6, 4, 15)] |
51.9 ms | 54.3 ms | -4.37% |
| ❌ | Simulation | ls_recursive_deep_tree[(200, 2)] |
1.7 ms | 1.8 ms | -4.83% |
| ❌ | Simulation | ls_recursive_wide_tree[(10000, 1000)] |
36 ms | 37.7 ms | -4.34% |
| ⚡ | Simulation | cp_large_file[16] |
279.5 µs | 264.9 µs | +5.51% |
Comparing joknarf:classify_target (c9b81dc) with main (236e220)
Footnotes
-
46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
please fix the failing tasks |
Fixes #11542
gnu output incompatibility with
--classifyon symlink targetsbefore:
after (gnu identical output):