[Lazarus-es] Carga lenta de cadenas al usar TZSQLProcessor
Antonio Évora
aevorar en gmail.com
Jue Dic 13 12:15:43 CET 2012
Hola a todos,
Pues como digo en el asunto, he estado haciendo pruebas de carga de un
TStrings y la diferencia entre cargar un TStringList y el Script del
TZSQLProcessor (TStrings) tarda del orden de 750 veces mas :-(
El código del formulario de pruebas es:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses ZSqlProcessor, LCLIntf;
const
LIMITE=1000;
procedure TForm1.Button1Click(Sender: TObject);
var
BSQL: TZSQLProcessor;
n: integer;
Contador: DWord;
begin
BSQL:=TZSQLProcessor.Create(nil);
Contador:=GetTickCount();
for n:=0 to Limite do
begin
BSQL.Script.Add('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
end;
ShowMessage(inttostr(GetTickCount()-Contador)+' ms');
BSQL.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
BSQL: TStringList;
n: integer;
Contador: DWord;
begin
BSQL:=TStringList.Create();
Contador:=GetTickCount();
for n:=0 to Limite do
begin
BSQL.Add('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
end;
ShowMessage(inttostr(GetTickCount()-Contador)+' ms');
BSQL.Free;
end;
end.
¿?¿?Alguna idea/solución¿?¿?
Gracias de antemano.
Saludos.
More information about the Lazarus-es
mailing list