From 88ea1d33fa92e26bcc44ed1a42b172af1b780c10 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 26 May 2016 20:50:11 +0200 Subject: [PATCH] Full hydration + query benchmark --- .../Hydration/SimpleHydrationBench.php | 58 +++++++++++++++++++ .../ORM/Functional/Ticket/DDC1050Test.php | 39 ------------- 2 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 tests/Doctrine/Performance/Hydration/SimpleHydrationBench.php delete mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php diff --git a/tests/Doctrine/Performance/Hydration/SimpleHydrationBench.php b/tests/Doctrine/Performance/Hydration/SimpleHydrationBench.php new file mode 100644 index 000000000..c1bc1d61d --- /dev/null +++ b/tests/Doctrine/Performance/Hydration/SimpleHydrationBench.php @@ -0,0 +1,58 @@ +entityManager = EntityManagerFactory::getEntityManager([ + \Doctrine\Tests\Models\CMS\CmsUser::class, + \Doctrine\Tests\Models\CMS\CmsPhonenumber::class, + \Doctrine\Tests\Models\CMS\CmsAddress::class, + \Doctrine\Tests\Models\CMS\CmsEmail::class, + \Doctrine\Tests\Models\CMS\CmsGroup::class, + \Doctrine\Tests\Models\CMS\CmsTag::class, + \Doctrine\Tests\Models\CMS\CmsArticle::class, + \Doctrine\Tests\Models\CMS\CmsComment::class, + ]); + + for ($i = 2; $i < 10000; ++$i) { + $user = new CmsUser(); + + $user->status = 'developer'; + $user->username = 'jwage' . $i; + $user->name = 'Jonathan'; + + $this->entityManager->persist($user); + } + + $this->entityManager->flush(); + $this->entityManager->clear(); + + $this->repository = $this->entityManager->getRepository(CmsUser::class); + } + + public function benchSimpleFindOperationHydration() + { + $this->repository->findAll(); + } +} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php deleted file mode 100644 index 12c3898d8..000000000 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php +++ /dev/null @@ -1,39 +0,0 @@ -markTestSkipped('performance skipped'); - - $this->useModelSet('cms'); - - parent::setUp(); - } - - public function testPerformance() - { - for ($i = 2; $i < 10000; ++$i) { - $user = new CmsUser(); - $user->status = 'developer'; - $user->username = 'jwage'.$i; - $user->name = 'Jonathan'; - $this->_em->persist($user); - } - $this->_em->flush(); - $this->_em->clear(); - - $s = microtime(true); - $users = $this->_em->getRepository(CmsUser::class)->findAll(); - $e = microtime(true); - echo __FUNCTION__ . " - " . ($e - $s) . " seconds" . PHP_EOL; - } -}