lsd
lsd copied to clipboard
refactor(name): reduce unnecessary String allocation
This PR improve performance of escape
and hyperlink
functions of Name
struct by reducing number of String
allocation.
TODO
- [x] Use
cargo fmt
- [ ] Add necessary tests
- [ ] Add changelog entry
- [ ] Update default config/theme in README (if applicable)
- [ ] Update man page at lsd/doc/lsd.md (if applicable)
Codecov Report
Merging #676 (4622927) into master (2ffb59c) will increase coverage by
0.01%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #676 +/- ##
==========================================
+ Coverage 88.32% 88.34% +0.01%
==========================================
Files 41 41
Lines 4607 4606 -1
==========================================
Hits 4069 4069
+ Misses 538 537 -1
Impacted Files | Coverage Δ | |
---|---|---|
src/meta/name.rs | 89.92% <100.00%> (+0.33%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 2ffb59c...4622927. Read the comment docs.
Is it really making much of a difference? I was getting mostly mixed results with original version being better(within error margin).
I tried it even without --tree
and pretty much similar results.
Hmm. Maybe this changes doesn't significantly improve performance of the program. However, I'll try writing a benchmark to test performance render
, escape
and hyperlink
functions of Name
struct.
What do you think about Cow<str>
? Do you have any concern about its complexity?
Do you have any concern about its complexity?
As long as it provides some perf improvement, I don't mind the added complexity.
I'm closing this PR for now. We can revisit it later if you think this could improve things here.