ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀
https://ratatui.rs
MIT License
8.96k stars 274 forks source link

perf(line): render line without clone #1082

Closed EdJoPaTo closed 2 months ago

EdJoPaTo commented 2 months ago

Due to the truncation the non truncation path used to_owned which cloned the line.

Calling an inner function on both cases resolves this as the temporary truncated line lives long enough for that function to end.


I have not benchmarked this. This is part of the improvements I did with #1049.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.1%. Comparing base (366c2a0) to head (7623df8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1082 +/- ## ======================================= + Coverage 89.4% 94.1% +4.7% ======================================= Files 61 61 Lines 15440 14632 -808 ======================================= - Hits 13808 13777 -31 + Misses 1632 855 -777 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

EdJoPaTo commented 2 months ago

Superseded by #1089