fix: use is_ascii_uppercase() for clippy compliance
9f59362
18 hours ago
by naoNao89
-0.09%
perf(ls): reduce small-dir sorting overhead and stabilize group-directories-first ordering
Use an adaptive strategy for Sort::Name: in-place comparator for small directories; cache bytes + index-permute for larger sets. Replace a second unstable sort for --group-directories-first with a stable partition via index permutation to preserve prior order.
1c55819
16 hours ago
by naoNao89
-0.34%
perf(ls): lower adaptive sort threshold from 64 to 24 entries
Reduces CodSpeed regression in recursive workloads with medium-sized directories.
Benchmark ls_recursive_balanced_tree has 19 entries per directory (4 subdirs + 15 files). With threshold=64, these use in-place sort, calling os_str_as_bytes_lossy() ~160 times per directory. Over 5,461 directories, this is ~874k conversions.
Lowering threshold to 24 triggers byte caching for these directories, reducing conversions to 19 per directory (~104k total). Expected improvement: ~8.4x fewer conversions = ~15% speedup.
Threshold remains above typical small directories (1-10 files) to avoid allocation overhead where in-place sort is faster.
d1b775f
5 hours ago
by naoNao89
+0.74%
fix(ls): correct threshold logic - use 16 to enable caching for 19-entry dirs
Previous threshold=24 still used in-place sort for 19-entry directories because the condition is 'n <= threshold'. The balanced tree benchmark has 19 entries per directory (4 subdirs + 15 files), so threshold must be <19 to trigger caching.
With threshold=16:
- Directories with ≤16 entries: in-place sort (fast for very small dirs)
- Directories with >16 entries: byte caching (fast for recursive workloads)
- Balanced tree (19 entries): now uses caching ✓
This should eliminate the 15% CodSpeed regression in ls_recursive_balanced_tree.
b270e76
5 hours ago
by naoNao89
+0.14%
perf(ls): hybrid caching strategy - always cache in recursive mode
Fixes recursive performance regression by detecting recursive mode and always using byte caching for those workloads. This is critical because recursive mode sorts thousands of small directories.
Strategy:
- Recursive mode OR large dirs (>8 entries): Use byte caching
- Non-recursive small dirs (≤8 entries): Use in-place sort
Recursive workloads like ls_recursive_balanced_tree sort ~5,461 directories with 19 entries each. Always caching in recursive mode eliminates repeated os_str_as_bytes_lossy() overhead.
Expected results:
- Recursive balanced/mixed/deep: Regression eliminated
- Non-recursive: Minimal overhead
- Wide trees: Continue improving (already using cache)
3aca88e
3 hours ago
by naoNao89
-0.62%
perf(ls): optimize locale sort with in-place algorithm
Replace hybrid caching strategy with simpler in-place sort.
Comprehensive benchmark comparison of 6 algorithms shows:
- Algorithm 4 (in-place) is 9% faster in recursive workloads
- Critical 19-entry dirs: 174.55µs vs 191.91µs (current)
- Simpler code with less allocation overhead
- No permutation complexity
Benchmark methodology:
- Tested sizes: 10, 19, 50, 100, 200 entries
- Patterns: sequential, reverse, random
- Recursive simulation: 100 dirs × 19 entries each
- Tool: Criterion.rs with 5s measurement time
Expected CodSpeed impact: -9% improvement in ls_recursive_balanced_tree