All Projects → sergeyklay → php-orm-benchmark

sergeyklay / php-orm-benchmark

Licence: MIT license
The benchmark to compare performance of PHP ORM solutions.

Programming Languages

PHP
23972 projects - #3 most used programming language
TSQL
950 projects

Projects that are alternatives of or similar to php-orm-benchmark

Karma Benchmark
A Karma plugin to run Benchmark.js over multiple browsers with CI compatible output.
Stars: ✭ 88 (+7.32%)
Mutual labels:  benchmarking, benchmark
Gatling Dubbo
A gatling plugin for running load tests on Apache Dubbo(https://github.com/apache/incubator-dubbo) and other java ecosystem.
Stars: ✭ 131 (+59.76%)
Mutual labels:  benchmarking, benchmark
Ezfio
Simple NVME/SAS/SATA SSD test framework for Linux and Windows
Stars: ✭ 91 (+10.98%)
Mutual labels:  benchmarking, benchmark
Pytest Django Queries
Generate performance reports from your django database performance tests.
Stars: ✭ 54 (-34.15%)
Mutual labels:  benchmarking, benchmark
Neo
Orm框架:基于ActiveRecord思想开发的至简化的java的Orm框架
Stars: ✭ 35 (-57.32%)
Mutual labels:  activerecord, orm-framework
Scalajs Benchmark
Benchmarks: write in Scala or JS, run in your browser. Live demo:
Stars: ✭ 63 (-23.17%)
Mutual labels:  benchmarking, benchmark
Benchexec
BenchExec: A Framework for Reliable Benchmarking and Resource Measurement
Stars: ✭ 108 (+31.71%)
Mutual labels:  benchmarking, benchmark
Rtb
Benchmarking tool to stress real-time protocols
Stars: ✭ 35 (-57.32%)
Mutual labels:  benchmarking, benchmark
Tsung
Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc.
Stars: ✭ 2,185 (+2564.63%)
Mutual labels:  benchmarking, benchmark
Are We Fast Yet
Are We Fast Yet? Comparing Language Implementations with Objects, Closures, and Arrays
Stars: ✭ 161 (+96.34%)
Mutual labels:  benchmarking, benchmark
Jsbench Me
jsbench.me - JavaScript performance benchmarking playground
Stars: ✭ 50 (-39.02%)
Mutual labels:  benchmarking, benchmark
Pwned
Simple C++ code for simple tasks
Stars: ✭ 16 (-80.49%)
Mutual labels:  activerecord, benchmarking
Dana
Test/benchmark regression and comparison system with dashboard
Stars: ✭ 46 (-43.9%)
Mutual labels:  benchmarking, benchmark
Jsperf.com
jsperf.com v2. https://github.com/h5bp/lazyweb-requests/issues/174
Stars: ✭ 1,178 (+1336.59%)
Mutual labels:  benchmarking, benchmark
Pibench
Benchmarking framework for index structures on persistent memory
Stars: ✭ 46 (-43.9%)
Mutual labels:  benchmarking, benchmark
Phoronix Test Suite
The Phoronix Test Suite open-source, cross-platform automated testing/benchmarking software.
Stars: ✭ 1,339 (+1532.93%)
Mutual labels:  benchmarking, benchmark
Bench Scripts
A compilation of Linux server benchmarking scripts.
Stars: ✭ 873 (+964.63%)
Mutual labels:  benchmarking, benchmark
Sysbench Docker Hpe
Sysbench Dockerfiles and Scripts for VM and Container benchmarking MySQL
Stars: ✭ 14 (-82.93%)
Mutual labels:  benchmarking, benchmark
Sltbench
C++ benchmark tool. Practical, stable and fast performance testing framework.
Stars: ✭ 137 (+67.07%)
Mutual labels:  benchmarking, benchmark
active-persistence
Active Persistence is a implementation of Active Record Query Interface for JPA that makes it easy and fun.
Stars: ✭ 14 (-82.93%)
Mutual labels:  activerecord, orm-framework

PHP ORM Benchmark Build Status

The benchmark to compare performance of PHP ORM solutions.

Initially this project used Docker to facilitate PHP ORM benchmarks. But after repeated comments we added support to benchmarksing on Travis CI. So everyone can see the results or run them again. Actually I've enabled the daily cron job on Travis CI.

We have noticed, that running benchmarks on Travis CI is a convenient, but not a very precise way to measure the code execution speed. The main reason for that is that Travis was designed to run tests. It shares resources between all re running builds and it means, that Travis cares about build execution, but it doesn't care about the performance, so benchmark results may vary from run to run. We will manually check results before publishing them to make sure they are not seriously affected by random performance of Travis, but you also can run the benchmark yourself using Docker.

ORMs to Benchmark

  • CakePHP ORM 3.5.10
  • Doctrine ORM 2.5.14
  • Eloquent 5.5.28
  • PHP ActiveRecord 1.2.0
  • Phalcon 3.3.1
  • Propel ORM 2.0.0-alpha7
  • Yii ActiveRecord 2.0.13.1
  • DMS 0.8.2
  • Nextras ORM 3.0.0-rc2

What we test

  • Insert a record to the Database
  • Get first record with relation
  • Get first record with relation and metadata caching
  • Insert a record to the Database (10-fold method call)
  • Get first record with relation (10-fold method call)
  • Get first record with relation and metadata caching (10-fold method call)
  • Get a batch of first 20 records with relation
  • Get a batch of first 20 records with relation and metadata caching
  • Get a batch of first 200 records with relation
  • Get a batch of first 200 records with relation and metadata caching

Travis CI Benchmarking Environment

  • Ubuntu 14.04.5 (Trusty) 64bit
  • PHP 7.0, 7.1, 7.2, 7.3
  • Zend OPcache 7.0, 7.1, 7.2, 7.3
  • MySQL 5.6

Getting Started

Requirements

  • Linux, macOS or BDS System
  • Docker CE/EE >= 17.09.0
  • Docker Compose >= 1.17
  • PHP >= 7.0
  • Composer

Build local image

First you have to build the benchmark application. Go to project root and run command as follows:

git clone [email protected]:sergeyklay/php-orm-benchmark.git
cd php-orm-benchmark
docker-compose build --force-rm --no-cache

We advise you to rely on Composer to manage projects’ dependencies. You have to download and install Composer itself in a common location or in project root by executing in a terminal the command like this:

wget http://getcomposer.org/composer.phar
# If you haven't wget on your computer
curl -s http://getcomposer.org/installer | php

Then, to install all project's dependencies, type the following from the project root:

php composer.phar install

Each ORM provider has its own dependencies. So you have to install them:

NOTE: If you have local composer.phar installed you'll need to replace composer install by php ../../composer.phar install

cd provider
for provider in `ls`; do echo $provider; cd $provider; composer install; cd ..; done

NOTE: You may skip Phalcon by running php composer.phar install --ignore-platform-reqs, if you don't have it installed at host system.

Finally, start the benchmark application:

docker-compose run benchmark

Running Benchmark

To run benchmark simple run command as follows:

php run <provider> <test>

Available providers are:

  • phalcon
  • propel
  • eloquent
  • cake
  • yii
  • doctrine
  • activerecord
  • dms
  • nextrasorm

Available tests are:

  • create
  • read

To run benchmark multiple times use:

php run <provider> <test> <times>

Some ORMs rely (depends) on models metadata caching. Thus, to avoid controversy there is an ability to create and run test with metadata caching support. To use models metadata caching (if supports) you can use the 4th command line argument as follows:

php run <provider> <test> <times> 1

Uninstall PHP ORM Benchmark

To destroy the application use the following command from the host system:

docker-compose down
docker volume rm phpormbenchmark_mysql

rm -rf <path_to_cloned_project>

Results

Get first record with relation (10-fold method call). Build #57, PHP 7.0.25.

ORM Elapsed time (ms) Used memory (KiB) Total memory usage (KiB) Method
CakePHP 7.68 98.06 1,610,421.10 find
DMS 7.42 199.06 2,503,541.10 get
Doctrine 4.29 83.99 2,179,349.09 findOneBy
Eloquent 3.24 55.27 1,526,709.09 firstOrFail
Propel 3.57 66.83 1,458,557.10 findPk
Yii 3.20 43.90 1,394,253.10 findOne
Phalcon 1.07 16.10 622,013.10 findFirst
PHP ActiveRecord 0.99 6.18 775,661.09 first

Get first record with relation (10-fold method call) with metadata caching. Build #57, PHP 7.0.25.

ORM Elapsed time (ms) Used memory (KiB) Total memory usage (KiB) Method
CakePHP 5.82 84.56 1,383,373.10 find
Yii 2.55 41.84 1,373,901.07 findOne
Doctrine 2.21 30.31 1,844,677.05 findOneBy
Phalcon 1.04 16.25 611,445.07 findFirst

Get a batch of 200 records with relation. # TBD

Get a batch of 200 records with relation and with metadata caching. # TBD

If you are interested in other resutls, see Travis CI build results.

Contributing

Contributions for new ORMs are more than welcome! If anyone feels that there is something missing or would like to suggest improvements please open a new issue or send a pull request.

References

License

The "PHP ORM Benchmark" is open source software licensed under the MIT License. See the LICENSE file for more.


Copyright © 2018 Serghei Iakovlev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].