13

I have recently learned about PDO and and Doctrine 2.2.2 to build an application. but i'will work with some critical constraints in my environment( a lot of data , connexion speed ...etc) i know that Doctrine have a PDO layer,so maybe PDO is faster but i want to work with a Real ORM Framework like Hibernate.

after reading this post Benchmark PDO vs Doctrine

I have to know if Doctrine is [ very ] slow than PDO.

Thank you

2
  • 2
    Comparing PDO with Doctrine is like comparing apples with apple trees. Also note, that Doctrine2 is faster
    – KingCrunch
    Apr 25, 2012 at 13:12
  • you are right , i know what you mean ; but i just need to know how much Doctrine is slow. thanks for your comment.
    – GENE
    Apr 25, 2012 at 14:52

2 Answers 2

40

Doctrine 2 + PHP 5.3+ improved greatly the speed of Doctrine.

However, you will never be close to PDO beacause it is not the same thing : do you want to query your database or do you want to automatically map your database to PHP Objects and then use objects in your code ?

  • For development quality, ease and speed : use Doctrine
  • For runtime speed : don't use an ORM
2
  • Thanks a lot ..i think i going to use doctrine 2
    – GENE
    Apr 25, 2012 at 15:06
  • 1
    After working on at-least 3 to 4 projects. I experienced that PDO is much much faster. For UX perspective I always choose PDO over ORM. You can always write neat and understandable code with normal SQL queries using DBAL layer.
    – TeaCupApp
    Jul 9, 2014 at 2:08
10

Using a PHP cache like APC will improve Doctrine's performance a lot. From what I've seen; somewhere between 3-7 times.
If you can't use a cache, you could easily switch to Doctrine's DBAL layer instead of the ORM in areas where you really need all the speed you can get. Runtime speeds will then be a lot closer to PDO, but you will lose the convenience of an ORM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.