Page 1 of 1

UniDac with sqLite slow

Posted: Wed 10 Feb 2016 08:53
Hello,

i'm using the trial version in Delphi 10 an get heavy performance problems with a really simple test:

Code: Select all

Var
	I:Integer;
begin
        UniConnection1.Connected:=True;
	uniQuery1.SQL.Text:='INSERT INTO ott (Name, Number, Date) VALUES  (:Name, :Number, :Date)';
	For I:=0 to 100 do
  Begin
    uniQuery1.ParamByName('Name').asString:='UniDac ' + IntToStr(I);
    uniQuery1.ParamByName('Number').asInteger:=I;
    uniQuery1.ParamByName('Date').AsFloat:=Now;
    uniQuery1.ExecSQL;
  End;
It take about 9 seconds to execute!
If I use exact the same code using FireDac it takes about 100ms!

I doesnt change the default options of the connections.

If I use StartTransaction it get much faster, but why is it without so much slower as FireDac?

Edit:
I tried to discover the reason the last hour... No success...
Excuting on an other Windows 7 x64 pc uniDac is almost equal to FireDac even without using Transactions!
I tried to use direct=true to be sure not to use a bad sqLite3.dll on my system... No difference! I build an Release exe and deploy all needed bpls to a folder and execute it.... Same results: Inserting 100 Rows takes about 9 sec.
What can be wrong with my system? I never had bad perfomance issues with any other tasks.



Thanks for answering...

Sascha

Re: UniDac with sqLite slow

Posted: Wed 10 Feb 2016 13:07
by MaximG
Default SQLite settings are oriented not to high performance, but to data security. This explains the difference in performance between UniDAC and FireDAC: in FireDAC, the Locking_Mode parameter is Exclusive by default (PRAGMA locking_mode=EXCLUSIVE), and Synchronous=None (PRAGMA synchronous=0). Thus, for correct comparison of UniDAC and FireDAC performance, you should set identical parameter values for both products. See more details about how SQLite settings affect performance in our blog:

http://blog.devart.com/increasing-sqlit ... mance.html

Re: UniDac with sqLite slow

Posted: Thu 11 Feb 2016 16:01
Yes, I'm aware of the pragmas and their meaning. Due the speed difference was factor 900 I researched for problems in my system. As I moved the database file to an external USB drive the speed of Unidac got similar to firedac. Strange thing because I never noticed performance problems... Anyway, it is not UniDac...

Regards Sascha

Re: UniDac with sqLite slow

Posted: Mon 15 Feb 2016 13:14
by MaximG
Yes, indeed, according to your code, when you use UniDAC default settings, the used hardware specifics affect SQLite interaction performance