Skip to content

tf198/php-orm-benchmark

Repository files navigation

Requirements
------------

* linux or bsd system
* PHP 5.2 or greater
* pdo_sqlite

History
-------

Adapted from the propel benchmarks
http://propel.posterous.com/how-fast-is-propel-15


Getting from github
-------------------

    > git clone git://github.com/tf198/php-orm-benchmark.git
    > cd php-orm-benchmark
	> make

Running All The Benchmarks
--------------------------

    > php TestRunner.php

Running One Of The Benchmarks
-----------------------------

    > php dormio_01/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

Result
------
On my fairly old laptop with the run counts adjusted to give about 100 to PDO

                      | Insert | findPk | complex| hydrate|  with  |     MB |
                      |--------|--------|--------|--------|--------|--------|
               OptPDO |     42 |     46 |     96 |     80 |     65 |   0.54 |
                  PDO |    105 |    111 |    105 |    108 |    107 |   0.52 |
            OptDormio |     64 |    103 |    121 |    119 |     72 |   1.01 |
               Dormio |    313 |    125 |    146 |    200 |    203 |   0.96 |
             Outlet07 |    792 |     80 |    178 |    416 |    518 |   2.09 |
             Propel14 |   1453 |    601 |    183 |    364 |    397 |   2.98 |
             Propel15 |   1301 |    709 |    231 |    466 |    573 |   7.24 |
    Propel15WithCache |   1183 |    504 |    198 |    374 |    421 |   7.32 |
           Doctrine12 |   2445 |   3552 |    655 |   1968 |   2196 |  13.36 |

Latest results are at https://github.com/tf198/php-orm-benchmark/blob/master/result.txt
           
Disclaimer
----------
Benchmarks are pointless.
I agree entirely, with the following exceptions...

1) Some libraries are just too bloated (Doctrine?) and we should ask questions
as to why it is we have to raise the instance memory above 16M.

2) They can be used as a great development tool.  Running the benchmarks periodically
while working on the code enables you to see and jumps in memory usage or execution time
and track down rogue object references etc.  They  also make you think about whether that
3000 line cool feature you've added really needs to be loaded every time.

3) Who doesn't like seeing their library outperform the competition by such a factor :)

Disclaimer 2: In case you hadn't guessed, Im behind Dormio so entirely biased.

About

A benchmark of common PHP ORMs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages