Hello Luciano
The SearchPanel uses threads, but they are not involved in the algorithm for searching the next value in the grid.
If you want to understand the search algorithm, set a breakpoint in the TCustomDBGridEh.LocateText method and step through it.
It is possible that the component itself retrieves field values very slowly or moves to the next TUniQuery record inefficiently.
Compare the speed of retrieving all values from your dataset using the following procedure.
Code:
procedure TForm1.GetAllValuesInDataSet(DataSet: TDataSet; Memo: TMemo);
var
i: Integer;
FieldValue: String;
Stopwatch: TStopwatch;
begin
Memo.Clear;
if not DataSet.Active or DataSet.IsEmpty then
begin
Memo.Lines.Add('DataSet is empty or not active.');
Exit;
end;
Stopwatch := TStopwatch.StartNew;
DataSet.DisableControls;
try
DataSet.First;
while not DataSet.Eof do
begin
// Memo.Lines.Add('--- Record ---');
for i := 0 to DataSet.FieldCount - 1 do
begin
FieldValue := DataSet.Fields[i].DisplayText;
// Memo.Lines.Add(Format('%s = %s',
// [DataSet.Fields[i].FieldName, VarToStr(FieldValue)]));
end;
DataSet.Next;
end;
finally
DataSet.EnableControls;
end;
Stopwatch.Stop;
Memo.Lines.Add(Format('Execution time: %d ms', [Stopwatch.ElapsedMilliseconds]));
end;