On an recent notebook computer (Core i7 and SSD drive), depending
on the back-end database interfaced, mORMot excels in speed:
- You can persist up to 570,000 objects per second, or retrieve more than
900,000 objects per second (for our pure Delphi in-memory engine);
- When data is retrieved from server or
client cache, you can read more than 900,000 objects per second, whatever
the database back-end is;
- With a high-performance database like Oracle and our direct access classes,
you can write 65,000 (via array binding) and read 160,000 objects per second,
over a 100 MB network;
- When using alternate database access libraries (e.g. Zeos, or
DB.pas
based classes), speed is lower, but still enough for most
work.
Difficult to find a faster ORM, I suspect.
The following tables try to sum up all available possibilities, and give
some benchmark (average objects/second for writing or read).
In these tables:
- 'SQLite3 (file full/off/exc)' indicates use of the internal
SQLite3 engine, with or
without
Synchronous := smOff
and/or DB.LockingMode :=
lmExclusive
;
- 'SQLite3 (mem)' stands for the internal SQLite3 engine running in
memory;
- 'SQLite3 (ext ...)' is about access to a SQLite3 engine as
external database - either as file or memory;
- '
TObjectList
' indicates a
TSQLRestServerStaticInMemory
instance, either static (with no SQL
support) or virtual (i.e. SQL featured via SQLite3 virtual table
mechanism) which may persist the data on disk as JSON or compressed
binary;
- 'Oracle' shows the results of our direct OCI access layer
(
SynDBOracle.pas
);
- 'NexusDB' is the free embedded edition, available from official site;
- 'Zeos *' indicates that the database was accessed directly via the ZDBC
layer;
- 'FireDAC *' stands for FireDAC library;
- 'UniDAC *' stands for UniDAC library;
- 'BDE *' when using a BDE connection;
- 'ODBC *' for a direct access to ODBC;
- 'Jet' stands for a MSAccess database engine, accessed via
OleDB;
- 'MSSQL local' for a local connection to a MS SQL Express 2008 R2
running instance (this was the version installed with Visual Studio
2010), accessed via OleDB.
This list of database providers is to be extended in the future. Any
feedback is welcome!
Numbers are expressed in rows/second (or objects/second). This benchmark was
compiled with Delphi 7, so newer compilers may give even better results, with
in-lining and advanced optimizations.
Note that these tests are not about the relative speed of each database
engine, but reflect the current status of the integration of several DB
libraries within the mORMot database access.
Purpose here is not to say that one library or database is better or
faster than another, but publish a snapshot of current mORMot
persistence layer abilities.
In this timing, we do not benchmark only the "pure" SQL/DB layer access
(SynDB
units), but the whole Client-Server ORM of our framework:
process below includes read and write RTTI access of a TSQLRecord
,
JSON marshaling, CRUD/REST routing, virtual cross-database layer, SQL
on-the-fly translation. We just bypass the communication layer, since
TSQLRestClient
and TSQLRestServer
are run in-process,
in the same thread - as a TSQLRestServerDB
instance. So you have
here some raw performance testimony of our framework's ORM and RESTful
core.
You can compile the "15 - External DB performance
" supplied
sample code, and run the very same benchmark on your own configuration.