diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2022-11-29 03:53:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 03:53:58 -0500 |
commit | 9c3e60e74f0af93ed4ad7e8534db54e10219526a (patch) | |
tree | b8b3a43c4ee0053560233b3a37578128f13b3c3d /src/widgets | |
parent | 913c9ed5c67113ac3997b165f82cfd9543f7b572 (diff) |
other: slightly reduce the CPU time spent for draws (#918)
* other: group all dataset draws in a time chart
We used to draw each data set separately as a new canvas. Now, in one
canvas, we draw all datasets.
Note that this changes how dataset lines are drawn - rather than
drawing one on top of another, it now draws kinda all at once. This
effect is *kinda* a bit better IMO, but it might also look a bit
more cluttered.
* other: optimize truncate_text
Flamegraphs showed that this area seems to be a bit heavy at times with
some inefficient use of iterators and collection. This change should
hopefully optimize this a bit by reducing some collections or
reallocations.
There can also be some further optimizations with less allocations from
callers.
* Reduce some redundant draws
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/process_table/proc_widget_data.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/widgets/process_table/proc_widget_data.rs b/src/widgets/process_table/proc_widget_data.rs index 94736336..c067f92b 100644 --- a/src/widgets/process_table/proc_widget_data.rs +++ b/src/widgets/process_table/proc_widget_data.rs @@ -221,6 +221,7 @@ impl ProcWidgetData { impl DataToCell<ProcColumn> for ProcWidgetData { fn to_cell<'a>(&'a self, column: &ProcColumn, calculated_width: u16) -> Option<Text<'a>> { + // TODO: Optimize the string allocations here... Some(truncate_text( &match column { ProcColumn::CpuPercent => { |