Platform Used
Those numbers were taken from the "external database" sample, which is available on both versions of the framework.
This is the very same benchmark as used in previous benchmarks on this blog or our documentation. So you could compare the numbers.
But we run the tests on a new computer, featuring a Intel(R) Core(TM) i5-7300U cpu, from a good old Thinkpad T470 notebook, with a SATA SSD.
So on a more modern hardware, like a high-end AMD or Xeon server, the million inserts is easily passed. And on a slow VM, you will get pretty good numbers.
We run the tests on Linux x86_64 (Debian 11), compiled from FPC 3.2 stable - which is our target platform for performance.
In fact, performance matters mainly on the server side - clients are usually fast enough to run whatever process they need, and the ORM/database/persistence process is likely to be located on the server side. So in mORMot 2, we focused on a x86_64 Linux server for performance, which is the cheapest and safest solution around.
Both frameworks used our in-memory heap manager for FPC, written in x86_64 assembly. It has a noticeable performance benefit, especially on multi-thread process (not shown here, but during the main regression tests).
Insertion Speed
Here are the mORMot 2 insertion numbers:
Running tests using Synopse mORMot framework 2.0.1, compiled with Free Pascal 3.2 64 bit, against SQLite 3.37.2, on Debian GNU/Linux 11 (bullseye) - Linux 5.10.0-10-amd64, at 2022-02-14 21:09:37.
Direct | Batch | Trans | Batch Trans | |
Sqlite file full | 98 | 5908 | 74089 | 242072 |
Sqlite file off | 13534 | 474428 | 151315 | 919624 |
Sqlite file off exc | 42961 | 691037 | 153374 | 929281 |
Sqlite file off exc aes | 26882 | 533788 | 152795 | 874814 |
Sqlite in memory | 114664 | 969743 | 152190 | 972478 |
In memory static | 411895 | 1086956 | 428724 | 1301236 |
In memory virtual | 385445 | 1200480 | 412762 | 1219660 |
External sqlite file full | 107 | 5957 | 83531 | 111043 |
External sqlite file off | 16509 | 291528 | 151890 | 390502 |
External sqlite file off exc | 58922 | 354924 | 150179 | 392649 |
External sqlite in memory | 114476 | 991080 | 154564 | 991375 |
Remote sqlite socket | 19789 | 155763 | 19439 | 236406 |
In comparison, here are the mORMot 1 performance - which was already ahead of most other solutions - on the same machine:
Running tests using Synopse mORMot framework 1.18.6365, compiled with Free Pascal 3.2 64 bit, against SQLite 3.37.2, on Debian GNU/Linux 11 (bullseye) - Linux 5.10.0-10-amd64, at 2022-02-15 10:27:28.
Direct | Batch | Trans | Batch Trans | |
Sqlite file full | 97 | 5034 | 45603 | 90704 |
Sqlite file off | 12504 | 212350 | 96605 | 272910 |
Sqlite file off exc | 36189 | 244702 | 94754 | 273687 |
Sqlite file off exc aes | 22933 | 219857 | 96513 | 267881 |
Sqlite in memory | 79953 | 275269 | 97776 | 269963 |
In memory static | 208125 | 473126 | 227821 | 505254 |
In memory virtual | 202683 | 467595 | 220031 | 472545 |
External sqlite file full | 100 | 2809 | 49603 | 102247 |
External sqlite file off | 15329 | 190701 | 109346 | 301768 |
External sqlite file off exc | 48818 | 264760 | 109767 | 304710 |
External sqlite in memory | 93820 | 303766 | 111437 | 311779 |
Remote sqlite socket | 17952 | 68360 | 14915 | 97096 |
As you can see, the performance benefits are noticeable. For a MicroService, an embedded SQlite3 storage may give pretty amazing scalability of your SOA processing.
Reading Speed
Here are the mORMot 2 reading numbers:
By one | All Virtual | All Direct | |
Sqlite file full | 115775 | 1151012 | 1121956 |
Sqlite file off | 123198 | 1157407 | 1162925 |
Sqlite file off exc | 270504 | 1162790 | 1174122 |
Sqlite file off exc aes | 269978 | 1160227 | 1171920 |
Sqlite in memory | 273950 | 1154201 | 1150350 |
In memory static | 467551 | 1803751 | 1743071 |
In memory virtual | 464209 | 771188 | 777786 |
External sqlite file full | 184836 | 522247 | 1142204 |
External sqlite file off | 180900 | 519237 | 1155134 |
External sqlite file off exc | 186046 | 512583 | 1153003 |
External sqlite in memory | 274559 | 1168770 | 1182872 |
Remote sqlite socket | 22246 | 444820 | 873133 |
In comparison, here are the mORMot 1 performance - which was already ahead of most other solutions - on the same machine:
By one | All Virtual | All Direct | |
Sqlite file full | 72439 | 847888 | 848176 |
Sqlite file off | 73248 | 837100 | 858811 |
Sqlite file off exc | 111037 | 845737 | 848032 |
Sqlite file off exc aes | 112973 | 863557 | 869716 |
Sqlite in memory | 111766 | 864154 | 879043 |
In memory static | 229074 | 1395868 | 1401738 |
In memory virtual | 228081 | 625782 | 626095 |
External sqlite file full | 107587 | 412745 | 840618 |
External sqlite file off | 132890 | 393948 | 805023 |
External sqlite file off exc | 133347 | 411082 | 821422 |
External sqlite in memory | 135197 | 411658 | 820075 |
Remote sqlite socket | 19991 | 367161 | 643832 |
Feedback Welcome
We encourage you to download the full source of both framework, from:
Then you can compile the "15 - External DB performance" sample on mORMot 1, and "extdb-bench" example on mORMot 2.
Feedback is welcome in our forum, as usual!