You've already forked lazarus-ccr
fpspreadsheet: Fix speed drop when writing a single column only (reported and fixed by alex80, see http://forum.lazarus.freepascal.org/index.php/topic,28692.msg179682).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4184 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
object Form1: TForm1
|
||||
Left = 445
|
||||
Height = 562
|
||||
Height = 593
|
||||
Top = 178
|
||||
Width = 764
|
||||
Caption = 'fpsSpeedTest'
|
||||
ClientHeight = 562
|
||||
ClientHeight = 593
|
||||
ClientWidth = 764
|
||||
KeyPreview = True
|
||||
OnCloseQuery = FormCloseQuery
|
||||
@ -14,7 +14,7 @@ object Form1: TForm1
|
||||
object StatusBar: TStatusBar
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 539
|
||||
Top = 570
|
||||
Width = 764
|
||||
Panels = <>
|
||||
end
|
||||
@ -61,12 +61,12 @@ object Form1: TForm1
|
||||
end
|
||||
object ParameterPanel: TPanel
|
||||
Left = 0
|
||||
Height = 483
|
||||
Height = 514
|
||||
Top = 56
|
||||
Width = 182
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 483
|
||||
ClientHeight = 514
|
||||
ClientWidth = 182
|
||||
TabOrder = 2
|
||||
object CbVirtualModeOnly: TCheckBox
|
||||
@ -161,6 +161,14 @@ object Form1: TForm1
|
||||
0700000002020202020202
|
||||
}
|
||||
end
|
||||
object CbSingleCol: TCheckBox
|
||||
Left = 16
|
||||
Height = 19
|
||||
Top = 480
|
||||
Width = 96
|
||||
Caption = 'Single column'
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
Left = 0
|
||||
@ -172,7 +180,7 @@ object Form1: TForm1
|
||||
end
|
||||
object Memo: TMemo
|
||||
Left = 182
|
||||
Height = 483
|
||||
Height = 514
|
||||
Top = 56
|
||||
Width = 582
|
||||
Align = alClient
|
||||
|
@ -20,6 +20,7 @@ type
|
||||
CgFormats: TCheckGroup;
|
||||
CgRowCount: TCheckGroup;
|
||||
CbVirtualModeOnly: TCheckBox;
|
||||
CbSingleCol: TCheckBox;
|
||||
LblCancel: TLabel;
|
||||
Panel1: TPanel;
|
||||
Memo: TMemo;
|
||||
@ -213,6 +214,7 @@ var
|
||||
Tm: DWORD;
|
||||
fName, S: string;
|
||||
k: Integer;
|
||||
numCols: Integer;
|
||||
begin
|
||||
MyWorkbook := TsWorkbook.Create;
|
||||
try
|
||||
@ -221,6 +223,11 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
if CbSingleCol.Checked then
|
||||
numCols := 1
|
||||
else
|
||||
numCols := COLCOUNT;
|
||||
|
||||
MyWorksheet := MyWorkbook.AddWorksheet('Sheet1');
|
||||
MyWorkbook.Options := Options;
|
||||
|
||||
@ -231,7 +238,7 @@ begin
|
||||
if boVirtualMode in Options then
|
||||
begin
|
||||
MyWorkbook.VirtualRowCount := Rows;
|
||||
MyWorkbook.VirtualColCount := COLCOUNT;
|
||||
MyWorkbook.VirtualColCount := numCols;
|
||||
case RgContent.ItemIndex of
|
||||
0: MyWorkbook.OnWriteCellData := @WriteCellStringHandler;
|
||||
1: MyWorkbook.OnWriteCellData := @WriteCellNumberHandler;
|
||||
@ -250,13 +257,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
case RgContent.ItemIndex of
|
||||
0: for ACol := 0 to COLCOUNT-1 do begin
|
||||
0: for ACol := 0 to numCols-1 do begin
|
||||
S := 'Xy' + IntToStr(ARow) + 'x' + IntToStr(ACol);
|
||||
MyWorksheet.WriteUTF8Text(ARow, ACol, S);
|
||||
end;
|
||||
1: for ACol := 0 to COLCOUNT-1 do
|
||||
1: for ACol := 0 to numCols-1 do
|
||||
MyWorksheet.WriteNumber(ARow, ACol, 1E5*ARow + ACol);
|
||||
2: for ACol := 0 to COLCOUNT-1 do
|
||||
2: for ACol := 0 to numCols-1 do
|
||||
if (odd(ARow) and odd(ACol)) or odd(ARow+ACol) then
|
||||
begin
|
||||
S := 'Xy' + IntToStr(ARow) + 'x' + IntToStr(ACol);
|
||||
@ -332,12 +339,15 @@ var
|
||||
i, len: Integer;
|
||||
s: String;
|
||||
rows: Integer;
|
||||
numCols: Integer;
|
||||
begin
|
||||
WriteToIni;
|
||||
|
||||
FEscape := false;
|
||||
EnableControls(false);
|
||||
|
||||
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
||||
|
||||
Memo.Append ('Running: Reading TsWorkbook from various file formats');
|
||||
Memo.Append (' Worksheet contains ' + CONTENT_TEXT[RgContent.ItemIndex]);
|
||||
Memo.Append (' (Times in seconds)');
|
||||
@ -370,7 +380,7 @@ begin
|
||||
continue;
|
||||
|
||||
rows := GetRowCount(i);
|
||||
s := Format('%7.0nx%d', [1.0*rows, COLCOUNT]);
|
||||
s := Format('%7.0nx%d', [1.0*rows, numCols]);
|
||||
|
||||
if CbVirtualModeOnly.Checked then begin
|
||||
RunReadTest(2, s + ' [boVM ]', [boVirtualMode]);
|
||||
@ -396,11 +406,13 @@ var
|
||||
Rows: integer;
|
||||
s: String;
|
||||
i, len: Integer;
|
||||
numCols: Integer;
|
||||
begin
|
||||
WriteToIni;
|
||||
|
||||
FEscape := false;
|
||||
EnableControls(false);
|
||||
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
||||
|
||||
Memo.Append ('Running: Building TsWorkbook and writing to different file formats');
|
||||
Memo.Append (' Worksheet contains ' + CONTENT_TEXT[RgContent.ItemIndex]);
|
||||
@ -433,7 +445,7 @@ begin
|
||||
if not CgRowCount.Checked[i] then
|
||||
continue;
|
||||
Rows := GetRowCount(i);
|
||||
s := Format('%7.0nx%d', [1.0*Rows, COLCOUNT]);
|
||||
s := Format('%7.0nx%d', [1.0*Rows, numCols]);
|
||||
if CbVirtualModeOnly.Checked then begin
|
||||
RunWriteTest(2, Rows, s + ' [boVM ]', [boVirtualMode]);
|
||||
RunWriteTest(4, Rows, s + ' [boVM, boBS]', [boVirtualMode, boBufStream]);
|
||||
|
@ -910,8 +910,8 @@ begin
|
||||
|
||||
FFirstRowIndex := $FFFFFFFF;
|
||||
FFirstColIndex := $FFFFFFFF;
|
||||
FLastRowIndex := 0;
|
||||
FLastColIndex := 0;
|
||||
FLastRowIndex := $FFFFFFFF;
|
||||
FLastColIndex := $FFFFFFFF;
|
||||
|
||||
FActiveCellRow := Cardinal(-1);
|
||||
FActiveCellCol := Cardinal(-1);
|
||||
@ -1873,9 +1873,9 @@ begin
|
||||
else FFirstColIndex := Min(FFirstColIndex, ACol);
|
||||
if FFirstRowIndex = $FFFFFFFF then FFirstRowIndex := GetFirstRowIndex(true)
|
||||
else FFirstRowIndex := Min(FFirstRowIndex, ARow);
|
||||
if FLastColIndex = 0 then FLastColIndex := GetLastColIndex(true)
|
||||
if FLastColIndex = $FFFFFFFF then FLastColIndex := GetLastColIndex(true)
|
||||
else FLastColIndex := Max(FLastColIndex, ACol);
|
||||
if FLastRowIndex = 0 then FLastRowIndex := GetLastRowIndex(true)
|
||||
if FLastRowIndex = $FFFFFFFF then FLastRowIndex := GetLastRowIndex(true)
|
||||
else FLastRowIndex := Max(FLastRowIndex, ARow);
|
||||
end;
|
||||
|
||||
@ -2103,7 +2103,7 @@ function TsWorksheet.GetLastColIndex(AForceCalculation: Boolean = false): Cardin
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if AForceCalculation then
|
||||
if AForceCalculation or (FLastColIndex = $FFFFFFFF) then
|
||||
begin
|
||||
// Traverse the tree from lowest to highest.
|
||||
// Since tree primary sort order is on row highest col could exist anywhere.
|
||||
@ -2206,7 +2206,7 @@ function TsWorksheet.GetLastRowIndex(AForceCalculation: Boolean = false): Cardin
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if AForceCalculation then
|
||||
if AForceCalculation or (FLastRowIndex = $FFFFFFFF) then
|
||||
begin
|
||||
// Index of highest row with at least one existing cell
|
||||
Result := GetLastOccupiedRowIndex;
|
||||
@ -5459,10 +5459,10 @@ begin
|
||||
FillChar(Result^, SizeOf(TCol), #0);
|
||||
Result^.Col := ACol;
|
||||
FCols.Add(Result);
|
||||
if FFirstColIndex = 0
|
||||
if FFirstColIndex = $FFFFFFFF
|
||||
then FFirstColIndex := GetFirstColIndex(true)
|
||||
else FFirstColIndex := Min(FFirstColIndex, ACol);
|
||||
if FLastColIndex = 0
|
||||
if FLastColIndex = $FFFFFFFF
|
||||
then FLastColIndex := GetLastColIndex(true)
|
||||
else FLastColIndex := Max(FLastColIndex, ACol);
|
||||
end;
|
||||
|
Reference in New Issue
Block a user