Home

Awesome

Requirements

Running All The Benchmarks

> cd /path/to/php-orm-benchmark
> php TestRunner.php

Running One Of The Benchmarks

> cd /path/to/php-orm-benchmark
> cd propel_20
> php TestRunner.php

Test Scenarios

  1. Mass insertion: Tests model objects and save() operations.

  2. Retrieve By Pk: Tests basic hydration

  3. Complex Query an OR but no hydration: Tests Query parsing

  4. Basic Query with 5 results: Tests hydration and collections

  5. Query with join: Tests join hydration

Results

The reference is the PDOTestSuite (the number of tests is adjusted to make raw PDO score about 100 to each test). For the ORMs, the smaller score is the better (i. e. the faster).

PHP CLI 7.1.0

(updated 2017-Feb-1)

LibraryInsertfindPkcomplexhydratewithmemory usagetime
PDO24510561841,699,1360.28
Maghead91156952288,388,6080.48
LessQL102263301421757,990,7280.78
YiiM17220309953066,291,4560.92
YiiMWithCache160213081003046,291,4560.91
Yii2M316402931603406,291,4561.17
Yii2MArrayHydrate305423151002916,291,4561.07
Yii2MScalarHydrate304432961071776,291,4560.94
Propel20140164102874138,388,6081.27
Propel20WithCache111103632473368,388,6081.08
Propel20FormatOnDemand96113662233348,388,6081.04
DoctrineM1833831122722018,874,3681.02
DoctrineMWithCache1924531023723318,874,3681.05
DoctrineMArrayHydrate1784529213616216,777,2160.86
DoctrineMScalarHydrate1784029611913616,777,2160.81
DoctrineMWithoutProxies1684032017235216,777,2161.09
Eloquent367543731573118,388,6081.28
EloquentWithoutEvent313423771572828,388,6081.18

PHP CLI 5.6.4 with opcode cache

(updated 2015-Dec-07)

LibraryInsertfindPkcomplexhydratewithmemory usagetime
PDO494503392775,2640.22
LessQL15315401141355,232,8800.57
YiiM2111380792019,961,4720.67
YiiMWithCache2171480882229,961,4720.71
Yii2M603338018725214,155,7761.46
Yii2MArrayHydrate585327012022014,155,7761.31
Yii2MScalarHydrate571321010510214,155,7761.17
Propel20218105026332310,747,9040.98
Propel20WithCache15668022826110,747,9040.77
Propel20FormatOnDemand15167022126411,010,0480.76
DoctrineM252280034219317,301,5041.55
DoctrineMWithCache266272033218917,039,3601.54
DoctrineMArrayHydrate263282022614117,825,7921.35
DoctrineMScalarHydrate242292019212317,825,7921.25
DoctrineMWithoutProxies243266025325116,777,2161.43
Eloquent419254012621811,534,3361.09
EloquentWithoutEvent380260012423211,534,3361.06

HHVM CLI 3.10.1 (Corresponding roughly to an up-to-date PHP 5.6)

(updated 2015-Dec-07)

LibraryInsertfindPkcomplexhydratewithmemory usagetime
PDO543003792783,6800.23
LessQL16519407813510,316,5840.66
YiiM3331940814947,267,4241.33
YiiMWithCache3371910814657,286,0401.30
Yii2M72227201031759,025,4001.90
Yii2MArrayHydrate70227301001659,033,2721.83
Yii2MScalarHydrate700291090708,997,1601.74
Propel2054516907715129,740,6962.30
Propel20WithCache48113507364859,807,6882.14
Propel20FormatOnDemand47912806754639,822,6962.05
DoctrineM6346470100934219,639,5605.11
DoctrineMWithCache6246740104733919,635,1285.07
DoctrineMArrayHydrate629642080424918,447,2324.73
DoctrineMScalarHydrate618634074720317,366,3364.55
DoctrineMWithoutProxies620629084935719,402,0324.85
Eloquent58927309820314,652,4881.53
EloquentWithoutEvent54726409920614,572,1121.45

HHVM 3.11.x (Corresponding roughly to an up-to-date PHP 7.0)

TODO

Running benchmarks using the Docker shell

See .docker-stack/README.md