Improve performance of explore - 1 (#13116)

Could be improved further I guess; but not here;

You can test the speed differences using data from #13088

```nu
open data.db | get profiles | explore
```

address: #13062

________

1. Noticed that search does not work anymore (even on `main` branch).
2. Not sure about resolved merged conflicts, seems fine, but maybe
something was lost.

---------

Co-authored-by: Reilly Wood <reilly.wood@icloud.com>
This commit is contained in:
Maxim Zhiburt
2024-06-13 04:35:04 +03:00
committed by GitHub
parent 634361b2d1
commit 323d5457f9
7 changed files with 159 additions and 148 deletions

View File

@ -259,9 +259,7 @@ fn draw_table(
table.with(width_ctrl);
}
let tablewidth = table.total_width();
table_to_string(table, tablewidth, termwidth)
table_to_string(table, termwidth)
}
fn set_indent(table: &mut Table, left: usize, right: usize) {
@ -289,7 +287,9 @@ fn set_border_head(table: &mut Table, with_footer: bool, wctrl: TableWidthCtrl)
}
}
fn table_to_string(table: Table, total_width: usize, termwidth: usize) -> Option<String> {
fn table_to_string(table: Table, termwidth: usize) -> Option<String> {
let total_width = table.total_width();
if total_width > termwidth {
None
} else {
@ -318,6 +318,7 @@ impl TableOption<NuRecords, CompleteDimensionVecRecords<'_>, ColoredConfig> for
dim: &mut CompleteDimensionVecRecords<'_>,
) {
let total_width = get_total_width2(&self.width, cfg);
if total_width > self.max {
TableTrim {
max: self.max,