mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Performance: use first 1000 rows only for calculating the CSV export size, and interpolate the rest. Closes #804
This commit is contained in:
@ -413,7 +413,7 @@ var
|
|||||||
Node: PVirtualNode;
|
Node: PVirtualNode;
|
||||||
Col, ExcludeCol: TColumnIndex;
|
Col, ExcludeCol: TColumnIndex;
|
||||||
RowNum: PInt64;
|
RowNum: PInt64;
|
||||||
SelectionSize, AllSize: Int64;
|
SelectionSize, AllSize, RowsCalculated: Int64;
|
||||||
begin
|
begin
|
||||||
GridData := Mainform.GridResult(Grid);
|
GridData := Mainform.GridResult(Grid);
|
||||||
AllSize := 0;
|
AllSize := 0;
|
||||||
@ -424,6 +424,7 @@ begin
|
|||||||
ExcludeCol := GridData.AutoIncrementColumn;
|
ExcludeCol := GridData.AutoIncrementColumn;
|
||||||
|
|
||||||
Node := GetNextNode(Grid, nil, False);
|
Node := GetNextNode(Grid, nil, False);
|
||||||
|
RowsCalculated := 0;
|
||||||
while Assigned(Node) do begin
|
while Assigned(Node) do begin
|
||||||
RowNum := Grid.GetNodeData(Node);
|
RowNum := Grid.GetNodeData(Node);
|
||||||
GridData.RecNo := RowNum^;
|
GridData.RecNo := RowNum^;
|
||||||
@ -436,8 +437,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
|
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
|
||||||
end;
|
end;
|
||||||
|
// Performance: use first rows only, and interpolate the rest, see issue #804
|
||||||
|
Inc(RowsCalculated);
|
||||||
|
if RowsCalculated >= 1000 then
|
||||||
|
Break;
|
||||||
Node := GetNextNode(Grid, Node, False);
|
Node := GetNextNode(Grid, Node, False);
|
||||||
end;
|
end;
|
||||||
|
if GridData.RecordCount > RowsCalculated then begin
|
||||||
|
AllSize := Round(AllSize / RowsCalculated * GridData.RecordCount);
|
||||||
|
end;
|
||||||
grpSelection.Items[0] := f_('Selection (%s rows, %s)', [FormatNumber(Grid.SelectedCount), FormatByteNumber(SelectionSize)]);
|
grpSelection.Items[0] := f_('Selection (%s rows, %s)', [FormatNumber(Grid.SelectedCount), FormatByteNumber(SelectionSize)]);
|
||||||
grpSelection.Items[1] := f_('Complete (%s rows, %s)', [FormatNumber(Grid.RootNodeCount), FormatByteNumber(AllSize)]);
|
grpSelection.Items[1] := f_('Complete (%s rows, %s)', [FormatNumber(Grid.RootNodeCount), FormatByteNumber(AllSize)]);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user