From 26a5713c278328e1fb4b1613b15d1dbfb79b1a0c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 16 Feb 2009 19:51:33 +0000 Subject: [PATCH] Performance fix: EnsureChunkLoaded should be called in a node, not cell context (which is way too often) --- source/helpers.pas | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/helpers.pas b/source/helpers.pas index cbaa56fc..6c31214b 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -856,13 +856,13 @@ begin if (Node.Index+1) mod 100 = 0 then ExportStatusMsg(Node, Grid.RootNodeCount, S.Size); tmp := ' ' + CRLF; - // Add cells. + // Ensure basic data is loaded + Mainform.EnsureChunkLoaded(Grid, Node); for i:=0 to Length(GridData.Columns) - 1 do begin // Skip hidden key columns if not (coVisible in Grid.Header.Columns[i].Options) then Continue; - // Ensure basic data is loaded and load remainder of large fields. - Mainform.EnsureChunkLoaded(Grid, Node); + // Load remainder of large fields. Mainform.EnsureFullWidth(Grid, i, Node); Data := Grid.Text[Node, i]; // Handle nulls. @@ -949,12 +949,13 @@ begin if (Node.Index+1) mod 100 = 0 then ExportStatusMsg(Node, Grid.RootNodeCount, S.Size); tmp := ''; + // Ensure basic data is loaded + Mainform.EnsureChunkLoaded(Grid, Node); for i:=0 to Grid.Header.Columns.Count-1 do begin // Skip hidden key columns if not (coVisible in Grid.Header.Columns[i].Options) then Continue; - // Ensure basic data is loaded and load remainder of large fields. - Mainform.EnsureChunkLoaded(Grid, Node); + // Load remainder of large fields. Mainform.EnsureFullWidth(Grid, i, Node); Data := Grid.Text[Node, i]; // Remove 0x. @@ -1018,15 +1019,14 @@ begin if (Node.Index+1) mod 100 = 0 then ExportStatusMsg(Node, Grid.RootNodeCount, S.Size); tmp := #9'' + CRLF; - // Data: + // Ensure basic data is loaded. + Mainform.EnsureChunkLoaded(Grid, Node); for i:=0 to Grid.Header.Columns.Count-1 do begin // Skip hidden key columns if not (coVisible in Grid.Header.Columns[i].Options) then Continue; // Print cell start tag. tmp := tmp + #9#9'<' + Grid.Header.Columns[i].Text; - // Ensure basic data is loaded. - Mainform.EnsureChunkLoaded(Grid, Node); if GridData.Rows[Node.Index].Cells[i].IsNull then tmp := tmp + ' isnull="true" />' + CRLF else begin if GridData.Columns[i].IsBinary then tmp := tmp + ' format="hex"'; @@ -1098,13 +1098,12 @@ begin end; Delete(tmp, Length(tmp)-1, 2); tmp := tmp + ') VALUES ('; - // Data: + // Ensure basic data is loaded. + Mainform.EnsureChunkLoaded(Grid, Node); for i:=0 to Grid.Header.Columns.Count-1 do begin // Skip hidden key columns if not (coVisible in Grid.Header.Columns[i].Options) then Continue; - // Ensure basic data is loaded. - Mainform.EnsureChunkLoaded(Grid, Node); if GridData.Rows[Node.Index].Cells[i].IsNull then tmp := tmp + 'NULL' else begin