Static bcc-compiled .obj

First of all, our version included with SynSQLite3Static.pas unit, is to be benchmarked.


Writing speed

  Direct Batch Trans Batch Trans
SQLite3 (file full) 477 389 97633 122865
SQLite3 (file off) 868 869 96827 125862
SQLite3 (mem) 84642 108624 104947 135105
TObjectList (static) 338478 575373 337336 572147
TObjectList (virtual) 338180 554446 331873 575837
SQLite3 (ext full) 486 496 101419 7011
SQLite3 (ext off) 799 303 105402 135109
SQLite3 (ext mem) 93893 129550 109027 152811


Reading speed

  By one All Virtual All Direct
SQLite3 (file full) 26924 494559 500200
SQLite3 (file off) 27750 496919 502714
SQLite3 (mem) 124402 444404 495392
TObjectList (static) 332778 907605 910249
TObjectList (virtual) 331038 404891 905961
SQLite3 (ext full) 102707 261547 521322
SQLite3 (ext off) 131130 255806 513505
SQLite3 (ext mem) 135784 248780 502664

Good old Borland C++ builder produces some efficient code here.
Those numbers are very good, when compared to the other two options.
Probably, using FastMM4 as memory manager and tuned compilation options do make sense.

Official MinGW-compiled sqlite3.dll

Here we used the official sqlite3.dll library, as published in the http://sqlite.org web site, and compiled with the MinGW/GCC compiler.


Writing speed

  Direct Batch Trans Batch Trans
SQLite3 (file full) 418 503 86322 119420
SQLite3 (file off) 918 873 93196 127317
SQLite3 (mem) 83108 106951 99892 138003
TObjectList (static) 320204 573723 324696 547465
TObjectList (virtual) 323247 563697 324443 564716
SQLite3 (ext full) 501 410 100152 133679
SQLite3 (ext off) 913 438 102806 135545
SQLite3 (ext mem) 96028 122798 108363 150920


Reading speed

  By one All Virtual All Direct
SQLite3 (file full) 26883 473529 438904
SQLite3 (file off) 27729 472188 451304
SQLite3 (mem) 116550 459432 457959
TObjectList (static) 318248 891265 905469
TObjectList (virtual) 327739 359040 892697
SQLite3 (ext full) 127346 180812 370288
SQLite3 (ext off) 127749 227759 438096
SQLite3 (ext mem) 129792 224386 436338


Visual C++ compiled sqlite3.dll

The Open Source wxsqlite project provides a sqlite3.dll library, compiled with Visual C++, and including RC4 and AES 128/256 encryption (better than the basic encryption implemented in SynSQLite3Static.pas) - not available in the official library.

See http://sourceforge.net/projects/wxcode/files/Components/wxSQLite3 to download the corresponding source code, and compiled .dll.


Writing speed

  Direct Batch Trans Batch Trans
SQLite3 (file full) 470 498 93801 112170
SQLite3 (file off) 886 819 90298 132883
SQLite3 (mem) 86897 110287 105207 140896
TObjectList (static) 332005 596445 321357 570776
TObjectList (virtual) 327225 585000 329272 579240
SQLite3 (ext full) 459 503 91086 140599
SQLite3 (ext off) 501 519 110338 150394
SQLite3 (ext mem) 98112 133276 117346 158634


Reading speed

  By one All Virtual All Direct
SQLite3 (file full) 28527 516689 521159
SQLite3 (file off) 28927 513769 519156
SQLite3 (mem) 127740 529100 523176
TObjectList (static) 335053 869262 879352
TObjectList (virtual) 334739 410374 885269
SQLite3 (ext full) 132594 258371 506277
SQLite3 (ext off) 138159 260892 507717
SQLite3 (ext mem) 139567 254919 516208

Under Windows, the Microsoft Visual C++ compiler gives very good results.
It is a bit faster than the other two, despite a somewhat less efficient virtual table process.

As a conclusion, our statically linked implementation sounds like the best overall approach: best speed for virtual tables (which is the core of our ORM), and no dll hell.
No library to deploy and copy, everything is embedded in the project executable, ready to run as expected.

Using external SQLite3 is also the open door to easy cross-platform of mORMot.
First step will be to finish the 64 bit compatibility of the framework, using the official x64 SQLite3.dll, which is much easier to work with than linking to .obj in Delphi.

Feedback is welcome in our forum.