From 32f1cd958549415c27daedfa41ef26fec839b217 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 21:50:17 +0200 Subject: [PATCH 01/15] Initial Travis CI config --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cd4a3bd --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +sudo: false +dist: trusty + +language: php + +php: + - 7.0 + +git: + depth: 1 + +script: + - true From 30714bf38ce94f3e1aa666c2be2fe9b0f0784f1f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 22:20:11 +0200 Subject: [PATCH 02/15] Introduced Phalcon installer with cache support --- .travis.yml | 34 +++++++++++++++++++++++++++++++++ ci/install_phalcon.sh | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 ci/install_phalcon.sh diff --git a/.travis.yml b/.travis.yml index cd4a3bd..a6ef117 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,39 @@ php: git: depth: 1 +env: + global: + - PHALCON_VERSION=v3.3.0 + matrix: + - PROVIDER=activerecord + - PROVIDER=cake + - PROVIDER=doctrine + - PROVIDER=eloquent + - PROVIDER=phalcon + - PROVIDER=propel + - PROVIDER=yii + +matrix: + fast_finish: true + +cache: + # See: https://github.com/travis-ci/travis-ci/issues/8714 + edge: true + apt: true + ccache: true + timeout: 604800 + directories: + - .temp + - $HOME/.ccache + - $HOME/.composer/cache + - $HOME/pear + - $HOME/.cache/src + - $HOME/.local/lib + +before_install: + - if [ $PROVIDER == "phalcon" ]; then + bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh + fi + script: - true diff --git a/ci/install_phalcon.sh b/ci/install_phalcon.sh new file mode 100644 index 0000000..a746e8f --- /dev/null +++ b/ci/install_phalcon.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# Ensure that this is being run inside a CI container +if [ "${CI}" != "true" ]; then + echo "This script is designed to run inside a CI container only. Exiting" + exit 1 +fi + +PHALCON_VERSION=${PHALCON_VERSION:-master} +PHP_MAJOR=`$(phpenv which php-config) --version | cut -d '.' -f 1,2` + +LOCAL_SRC_DIR=${HOME}/.cache/src/phalcon/${PHALCON_VERSION} +LOCAL_LIB_DIR=${HOME}/.local/lib +LOCAL_LIBRARY=${LOCAL_LIB_DIR}/phalcon-${PHALCON_VERSION}-${PHP_MAJOR}.so + +PHALCON_INI_FILE=${HOME}/.phpenv/versions/$(phpenv version-name)/etc/conf.d/50-phalcon.ini + +EXTENSION_DIR=`$(phpenv which php-config) --extension-dir` + +if [ ! -f ${LOCAL_LIBRARY} ]; then + mkdir -p ${LOCAL_SRC_DIR} + mkdir -p ${LOCAL_LIB_DIR} + + if [ ! -f ${LOCAL_SRC_DIR}/config.json ]; then + rm -rf ${LOCAL_SRC_DIR}/* + git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b ${PHALCON_VERSION} ${LOCAL_SRC_DIR} + fi + + cd ${LOCAL_SRC_DIR}/build + + ./install --phpize $(phpenv which phpize) --php-config $(phpenv which php-config) + + if [ ! -f "${EXTENSION_DIR}/phalcon.so" ]; then + echo "Unable to locate installed phalcon.so" + exit 1 + fi + + cp "${EXTENSION_DIR}/phalcon.so" ${LOCAL_LIBRARY} +fi + +echo "[Phalcon]" > ${PHALCON_INI_FILE} +echo "extension=${LOCAL_LIBRARY}" >> ${PHALCON_INI_FILE} + +php --ri phalcon || exit 1 From c10e7c5cd44b23d676ed4a73610695c89b5c0314 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 22:24:53 +0200 Subject: [PATCH 03/15] CC="ccache gcc" + fixed phalcon installer --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6ef117..e82acdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ git: env: global: + - CC="ccache gcc" - PHALCON_VERSION=v3.3.0 matrix: - PROVIDER=activerecord @@ -39,9 +40,8 @@ cache: - $HOME/.local/lib before_install: - - if [ $PROVIDER == "phalcon" ]; then - bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh - fi + - if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi; + - if [[ $PROVIDER == "phalcon" ]]; then bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh; fi; script: - true From a69768c9561c0a96d837b3ad9747e24a0cb2ae48 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 22:28:32 +0200 Subject: [PATCH 04/15] Tune up Travis CI --- .travis.yml | 14 ++++++++++++++ ci/benchmark.ini | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ci/benchmark.ini diff --git a/.travis.yml b/.travis.yml index e82acdd..7412b33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,8 +40,22 @@ cache: - $HOME/.local/lib before_install: + - ulimit -c unlimited -S || true - if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi; - if [[ $PROVIDER == "phalcon" ]]; then bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh; fi; +install: + - phpenv config-add $TRAVIS_BUILD_DIR/ci/benchmark.ini + - ls -al `$(phpenv which php-config) --extension-dir` + - $(phpenv which php) -v + - $(phpenv which php) -m + script: + - cd $TRAVIS_BUILD_DIR - true + +notifications: + # Stop spam me. I already live on Travis CI and GitHub + email: + on_success: never + on_failure: never diff --git a/ci/benchmark.ini b/ci/benchmark.ini new file mode 100644 index 0000000..2d9ace7 --- /dev/null +++ b/ci/benchmark.ini @@ -0,0 +1,21 @@ +date.timezone = UTC + +error_reporting = E_ALL + +display_errors = 1 +display_startup_errors = 1 + +log_errors = 1 + +memory_limit = -1 +max_execution_time = 300 + +opcache.memory_consumption = 128 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +opcache.validate_timestamps = off +opcache.fast_shutdown = 0 +opcache.enable_cli = 1 + +zend.assertions = 1 +assert.exception = 1 From 575dbb3cde70f224e30254bf5d7fc9834ba0cefc Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 22:49:24 +0200 Subject: [PATCH 05/15] Install MySQL --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7412b33..b466bc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,14 +41,23 @@ cache: before_install: - ulimit -c unlimited -S || true + - phpenv config-rm xdebug.ini || true - if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi; - if [[ $PROVIDER == "phalcon" ]]; then bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh; fi; install: + - (cd $TRAVIS_BUILD_DIR/provider/$PROVIDER; composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader) - phpenv config-add $TRAVIS_BUILD_DIR/ci/benchmark.ini - ls -al `$(phpenv which php-config) --extension-dir` - $(phpenv which php) -v - $(phpenv which php) -m + - echo 'SHOW VARIABLES LIKE "%version%"' | mysql -u root + +before_script: + - echo 'CREATE DATABASE orm_benchmark CHARSET=utf8 COLLATE=utf8_unicode_ci' | mysql -u root + - echo "CREATE USER 'enigma'@'%' IDENTIFIED BY 'secret'" | mysql -u root + - echo "GRANT ALL PRIVILEGES ON orm_benchmark.* TO 'enigma'@'%' WITH GRANT OPTION" | mysql -u root + - cat schema/orm-benchmark.sql | mysql -u root orm_benchmark script: - cd $TRAVIS_BUILD_DIR From 696ea4227946d1de389b3fc2371168afb40c0f09 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 9 Jan 2018 23:11:33 +0200 Subject: [PATCH 06/15] Initial tests --- .gitignore | 4 ++-- .travis.yml | 9 ++++++- config/activerecord.php | 2 +- config/cake.php | 2 +- config/doctrine.php | 2 +- config/eloquent.php | 2 +- config/phalcon.php | 2 +- config/propel.php | 6 +++-- config/yii.php | 2 +- provider/phalcon/composer.json | 2 +- provider/phalcon/composer.lock | 23 ++++++++++++++++++ provider/propel/Models/Base/Comments.php | 4 ++-- provider/propel/Models/Base/CommentsQuery.php | 2 +- provider/propel/Models/Base/Posts.php | 4 ++-- provider/propel/Models/Base/PostsQuery.php | 2 +- .../propel/Models/Map/CommentsTableMap.php | 6 ++--- provider/propel/Models/Map/PostsTableMap.php | 24 +++++++++++-------- run | 3 +++ src/Provider/Activerecord.php | 2 +- src/Provider/Propel.php | 4 ++-- 20 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 provider/phalcon/composer.lock diff --git a/.gitignore b/.gitignore index a8af03c..ee55034 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ # # https://help.github.com/articles/ignoring-files/#create-a-global-gitignore -wip/ -vendor/ +/provider/*/vendor/ +/vendor/ composer.phar diff --git a/.travis.yml b/.travis.yml index b466bc5..071a4d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ env: global: - CC="ccache gcc" - PHALCON_VERSION=v3.3.0 + - HAS_CACHING_METADATA_SUPPORT=0 matrix: - PROVIDER=activerecord - PROVIDER=cake @@ -47,6 +48,7 @@ before_install: install: - (cd $TRAVIS_BUILD_DIR/provider/$PROVIDER; composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader) + - (cd $TRAVIS_BUILD_DIR; composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader) - phpenv config-add $TRAVIS_BUILD_DIR/ci/benchmark.ini - ls -al `$(phpenv which php-config) --extension-dir` - $(phpenv which php) -v @@ -61,7 +63,12 @@ before_script: script: - cd $TRAVIS_BUILD_DIR - - true + - php run $PROVIDER read 1 + - php run $PROVIDER read 10 + - php run $PROVIDER create 1 + - php run $PROVIDER create 10 + - if [[ $HAS_CACHING_METADATA_SUPPORT == 1 ]]; then php run $PROVIDER read 1 1; fi; + - if [[ $HAS_CACHING_METADATA_SUPPORT == 1 ]]; then php run $PROVIDER read 10 1; fi; notifications: # Stop spam me. I already live on Travis CI and GitHub diff --git a/config/activerecord.php b/config/activerecord.php index 12a4372..f21d6ff 100644 --- a/config/activerecord.php +++ b/config/activerecord.php @@ -1,5 +1,5 @@ 'mysql://enigma:secret@mysql/orm_benchmark', + 'dsn' => 'mysql://enigma:secret@127.0.0.1/orm_benchmark', ]; diff --git a/config/cake.php b/config/cake.php index 0c4e781..8080de6 100644 --- a/config/cake.php +++ b/config/cake.php @@ -10,7 +10,7 @@ 'database' => [ 'className' => Connection::class, 'driver' => Mysql::class, - 'host' => 'mysql', + 'host' => '127.0.0.1', 'port' => 3306, 'database' => 'orm_benchmark', 'username' => 'enigma', diff --git a/config/doctrine.php b/config/doctrine.php index 33f27c0..ebc7bc9 100644 --- a/config/doctrine.php +++ b/config/doctrine.php @@ -2,7 +2,7 @@ return [ 'driver' => 'pdo_mysql', - 'host' => 'mysql', + 'host' => '127.0.0.1', 'dbname' => 'orm_benchmark', 'user' => 'enigma', 'password' => 'secret', diff --git a/config/eloquent.php b/config/eloquent.php index 87f64d9..7a9b555 100644 --- a/config/eloquent.php +++ b/config/eloquent.php @@ -2,7 +2,7 @@ return [ 'driver' => 'mysql', - 'host' => 'mysql', + 'host' => '127.0.0.1', 'database' => 'orm_benchmark', 'username' => 'enigma', 'password' => 'secret', diff --git a/config/phalcon.php b/config/phalcon.php index f293ad2..90e7f23 100644 --- a/config/phalcon.php +++ b/config/phalcon.php @@ -4,7 +4,7 @@ return [ 'database' => [ - 'host' => 'mysql', + 'host' => '127.0.0.1', 'port' => 3306, 'username' => 'enigma', 'password' => 'secret', diff --git a/config/propel.php b/config/propel.php index 74ff368..a5fd731 100644 --- a/config/propel.php +++ b/config/propel.php @@ -1,16 +1,18 @@ ConnectionWrapper::class, - 'dsn' => 'mysql:host=mysql;port=3306;dbname=orm_benchmark', + 'dsn' => 'mysql:host=127.0.0.1;port=3306;dbname=orm_benchmark', 'user' => 'enigma', 'password' => 'secret', 'settings' => [ 'charset' => 'utf8', ], 'model_paths' => [ - dirname(dirname(__FILE__)) . '/src/Models/Propel', + DOCROOT . '/provider/propel/Models', ], ]; diff --git a/config/yii.php b/config/yii.php index 695be76..67bda86 100644 --- a/config/yii.php +++ b/config/yii.php @@ -1,7 +1,7 @@ 'mysql:host=mysql;port=3306;dbname=orm_benchmark', + 'dsn' => 'mysql:host=127.0.0.1;port=3306;dbname=orm_benchmark', 'username' => 'enigma', 'password' => 'secret', 'charset' => 'utf8', diff --git a/provider/phalcon/composer.json b/provider/phalcon/composer.json index 32f8f54..a0529b2 100644 --- a/provider/phalcon/composer.json +++ b/provider/phalcon/composer.json @@ -1,7 +1,7 @@ { "require": { "php": ">=7.0.0", - "ext-phalcon": ">=3.2.0" + "ext-phalcon": ">=3.3.0" }, "config": { "platform": { diff --git a/provider/phalcon/composer.lock b/provider/phalcon/composer.lock new file mode 100644 index 0000000..50ac002 --- /dev/null +++ b/provider/phalcon/composer.lock @@ -0,0 +1,23 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "8e222a4335d3d1af4dccf406024712b4", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.0.0", + "ext-phalcon": ">=3.3.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.0.26" + } +} diff --git a/provider/propel/Models/Base/Comments.php b/provider/propel/Models/Base/Comments.php index 258959d..db10038 100644 --- a/provider/propel/Models/Base/Comments.php +++ b/provider/propel/Models/Base/Comments.php @@ -30,7 +30,7 @@ abstract class Comments implements ActiveRecordInterface /** * TableMap class name */ - const TABLE_MAP = '\\OrmBench\\Models\\Propel\\Map\\CommentsTableMap'; + const TABLE_MAP = '\\OrmBench\\Propel\\Models\\Map\\CommentsTableMap'; /** @@ -547,7 +547,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta return $startcol + 5; // 5 = CommentsTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException(sprintf('Error populating %s object', '\\OrmBench\\Models\\Propel\\Comments'), 0, $e); + throw new PropelException(sprintf('Error populating %s object', '\\OrmBench\\Propel\\Models\\Comments'), 0, $e); } } diff --git a/provider/propel/Models/Base/CommentsQuery.php b/provider/propel/Models/Base/CommentsQuery.php index f6b5fc9..23c593b 100644 --- a/provider/propel/Models/Base/CommentsQuery.php +++ b/provider/propel/Models/Base/CommentsQuery.php @@ -88,7 +88,7 @@ abstract class CommentsQuery extends ModelCriteria * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'default', $modelName = '\\OrmBench\\Models\\Propel\\Comments', $modelAlias = null) + public function __construct($dbName = 'default', $modelName = '\\OrmBench\\Propel\\Models\\Comments', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } diff --git a/provider/propel/Models/Base/Posts.php b/provider/propel/Models/Base/Posts.php index 35c1b6b..a4c5822 100644 --- a/provider/propel/Models/Base/Posts.php +++ b/provider/propel/Models/Base/Posts.php @@ -33,7 +33,7 @@ abstract class Posts implements ActiveRecordInterface /** * TableMap class name */ - const TABLE_MAP = '\\OrmBench\\Models\\Propel\\Map\\PostsTableMap'; + const TABLE_MAP = '\\OrmBench\\Propel\\Models\\Map\\PostsTableMap'; /** @@ -553,7 +553,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta return $startcol + 5; // 5 = PostsTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException(sprintf('Error populating %s object', '\\OrmBench\\Models\\Propel\\Posts'), 0, $e); + throw new PropelException(sprintf('Error populating %s object', '\\OrmBench\\Propel\\Models\\Posts'), 0, $e); } } diff --git a/provider/propel/Models/Base/PostsQuery.php b/provider/propel/Models/Base/PostsQuery.php index 845a59a..d168b81 100644 --- a/provider/propel/Models/Base/PostsQuery.php +++ b/provider/propel/Models/Base/PostsQuery.php @@ -88,7 +88,7 @@ abstract class PostsQuery extends ModelCriteria * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'default', $modelName = '\\OrmBench\\Models\\Propel\\Posts', $modelAlias = null) + public function __construct($dbName = 'default', $modelName = '\\OrmBench\\Propel\\Models\\Posts', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } diff --git a/provider/propel/Models/Map/CommentsTableMap.php b/provider/propel/Models/Map/CommentsTableMap.php index 1e71873..5ae9157 100644 --- a/provider/propel/Models/Map/CommentsTableMap.php +++ b/provider/propel/Models/Map/CommentsTableMap.php @@ -37,7 +37,7 @@ class CommentsTableMap extends TableMap /** * The related Propel class for this table */ - const OM_CLASS = '\\OrmBench\\Models\\Propel\\Comments'; + const OM_CLASS = '\\OrmBench\\Propel\\Models\\Comments'; /** * A class that can be returned by this tableMap @@ -130,7 +130,7 @@ public function initialize() $this->setName('comments'); $this->setPhpName('Comments'); $this->setIdentifierQuoting(false); - $this->setClassName('\\OrmBench\\Models\\Propel\\Comments'); + $this->setClassName('\\OrmBench\\Propel\\Models\\Comments'); $this->setPackage('OrmBench.Models.Propel'); $this->setUseIdGenerator(true); // columns @@ -146,7 +146,7 @@ public function initialize() */ public function buildRelations() { - $this->addRelation('Posts', '\\OrmBench\\Models\\Propel\\Posts', RelationMap::MANY_TO_ONE, array ( + $this->addRelation('Posts', '\\OrmBench\\Propel\\Models\\Posts', RelationMap::MANY_TO_ONE, array ( 0 => array ( 0 => ':post_id', diff --git a/provider/propel/Models/Map/PostsTableMap.php b/provider/propel/Models/Map/PostsTableMap.php index 6fbc2ef..da9ecfa 100644 --- a/provider/propel/Models/Map/PostsTableMap.php +++ b/provider/propel/Models/Map/PostsTableMap.php @@ -37,7 +37,7 @@ class PostsTableMap extends TableMap /** * The related Propel class for this table */ - const OM_CLASS = '\\OrmBench\\Models\\Propel\\Posts'; + const OM_CLASS = '\\OrmBench\\Propel\\Models\\Posts'; /** * A class that can be returned by this tableMap @@ -130,7 +130,7 @@ public function initialize() $this->setName('posts'); $this->setPhpName('Posts'); $this->setIdentifierQuoting(false); - $this->setClassName('\\OrmBench\\Models\\Propel\\Posts'); + $this->setClassName('\\OrmBench\\Propel\\Models\\Posts'); $this->setPackage('OrmBench.Models.Propel'); $this->setUseIdGenerator(true); // columns @@ -146,14 +146,18 @@ public function initialize() */ public function buildRelations() { - $this->addRelation('Comments', '\\OrmBench\\Models\\Propel\\Comments', RelationMap::ONE_TO_MANY, array ( - 0 => - array ( - 0 => ':post_id', - 1 => ':id', - ), -), 'CASCADE', null, 'Commentss', false); - } // buildRelations() + $this->addRelation( + 'Comments', + '\\OrmBench\\Propel\\Models\\Comments', + RelationMap::ONE_TO_MANY, + [[':post_id', ':id']], + 'CASCADE', + null, + 'Commentss', + false + ); + } + /** * Method to invalidate the instance pool of all tables related to posts * by a foreign key with ON DELETE CASCADE */ diff --git a/run b/run index a251246..ea7f9e2 100755 --- a/run +++ b/run @@ -28,11 +28,14 @@ try { Bootstrap::init($arguments[0], $arguments[1], $arguments[2], (bool) $arguments[3]); } catch (\AssertionError $e) { fprintf(STDERR, "Assertion error for: %s on %s:%d\n", $e->getMessage(), $e->getFile(), $e->getLine()); + exit(1); } catch(\BadMethodCallException $e) { fprintf(STDERR, "%s\n", $e->getMessage()); + exit(1); } catch (\Throwable $e) { fprintf(STDERR, "%s: %s on %s:%d\n", get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()); fprintf(STDERR, "%s\n", $e->getTraceAsString()); + exit(1); } $template =<<set_model_directory(DOCROOT . '/src/Models/Activerecord'); + $configurator->set_model_directory(DOCROOT . '/provider/activerecord/Models'); $configurator->set_connections([ 'development' => $config['dsn'], ]); diff --git a/src/Provider/Propel.php b/src/Provider/Propel.php index 8eaec66..0109cb2 100644 --- a/src/Provider/Propel.php +++ b/src/Provider/Propel.php @@ -11,14 +11,14 @@ class Propel extends AbstractProvider { public function setUp() { - require_once DOCROOT . '/config/propel.php'; + $config = require_once DOCROOT . '/config/propel.php'; $serviceContainer = PropelRuntime::getServiceContainer(); $serviceContainer->checkVersion('2.0.0-dev'); $serviceContainer->setAdapterClass('default', 'mysql'); $manager = new ConnectionManagerSingle(); - $manager->setConfiguration(require DOCROOT . '/config/propel.php'); + $manager->setConfiguration($config); $manager->setName('default'); $serviceContainer->setConnectionManager('default', $manager); From 8c4763a7e8829f83a7f5297afa9c51102f002721 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 00:08:42 +0200 Subject: [PATCH 07/15] Added PHP 7.1, 7.2, 7.3 --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 071a4d0..5d4bf6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,14 @@ language: php php: - 7.0 + - 7.1 + - 7.2 + - nightly + +matrix: + fast_finish: true + allow_failures: + - php: nightly git: depth: 1 @@ -13,6 +21,7 @@ env: global: - CC="ccache gcc" - PHALCON_VERSION=v3.3.0 + # TODO - HAS_CACHING_METADATA_SUPPORT=0 matrix: - PROVIDER=activerecord @@ -23,9 +32,6 @@ env: - PROVIDER=propel - PROVIDER=yii -matrix: - fast_finish: true - cache: # See: https://github.com/travis-ci/travis-ci/issues/8714 edge: true From cdf3a57b27ba12e59dee1166cea62f4491e97a12 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 00:22:31 +0200 Subject: [PATCH 08/15] Removed hardcoded PHP version from Composer config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actually only Doctrine need this to be able correct work on PHP 7.0.* I have no idea why ¯\_(ツ)_/¯ --- provider/activerecord/composer.json | 5 ---- provider/activerecord/composer.lock | 7 ++--- provider/cake/composer.json | 7 +---- provider/cake/composer.lock | 7 ++--- provider/doctrine/composer.lock | 2 +- provider/eloquent/composer.json | 5 ---- provider/eloquent/composer.lock | 21 ++++++-------- provider/phalcon/composer.json | 5 ---- provider/phalcon/composer.lock | 7 ++--- provider/propel/composer.json | 5 ---- provider/propel/composer.lock | 45 ++++++++++++++--------------- provider/yii/composer.json | 5 ---- provider/yii/composer.lock | 7 ++--- 13 files changed, 40 insertions(+), 88 deletions(-) diff --git a/provider/activerecord/composer.json b/provider/activerecord/composer.json index dcf5b3a..0856fbb 100644 --- a/provider/activerecord/composer.json +++ b/provider/activerecord/composer.json @@ -3,11 +3,6 @@ "php": ">=7.0.0", "php-activerecord/php-activerecord": "1.2.0" }, - "config": { - "platform": { - "php": "7.0.26" - } - }, "autoload": { "psr-4": { "OrmBench\\Activerecord\\": "./" diff --git a/provider/activerecord/composer.lock b/provider/activerecord/composer.lock index 0694672..a49d5f7 100644 --- a/provider/activerecord/composer.lock +++ b/provider/activerecord/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "fc0c63fff9901b61c56649b6eb53e851", + "content-hash": "78ae5a60c05f8a4fc31a51233ea5b08f", "packages": [ { "name": "php-activerecord/php-activerecord", @@ -56,8 +56,5 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } diff --git a/provider/cake/composer.json b/provider/cake/composer.json index da497b7..2732f82 100644 --- a/provider/cake/composer.json +++ b/provider/cake/composer.json @@ -2,12 +2,7 @@ "require": { "php": ">=7.0.0", "cakephp/orm": "3.5.10", - "cakephp/cache": "^3.5" - }, - "config": { - "platform": { - "php": "7.0.26" - } + "cakephp/cache": "3.5.10" }, "autoload": { "psr-4": { diff --git a/provider/cake/composer.lock b/provider/cake/composer.lock index 6fbeffe..6c09156 100644 --- a/provider/cake/composer.lock +++ b/provider/cake/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7a1b1a6b5515e7dc8f6bd3d6e2d66a87", + "content-hash": "b867fdffd3f139338acbd8143f16e0aa", "packages": [ { "name": "cakephp/cache", @@ -495,8 +495,5 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } diff --git a/provider/doctrine/composer.lock b/provider/doctrine/composer.lock index 2fd397e..8a4d5f0 100644 --- a/provider/doctrine/composer.lock +++ b/provider/doctrine/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "e9f630188dc7debb566bd3a7d53fdf04", + "content-hash": "7185e4c6827f83a605d239cadc95a520", "packages": [ { "name": "doctrine/annotations", diff --git a/provider/eloquent/composer.json b/provider/eloquent/composer.json index ef88933..5a0a541 100644 --- a/provider/eloquent/composer.json +++ b/provider/eloquent/composer.json @@ -4,11 +4,6 @@ "illuminate/database": "5.5.28", "illuminate/events": "5.5.28" }, - "config": { - "platform": { - "php": "7.0.26" - } - }, "autoload": { "psr-4": { "OrmBench\\Eloquent\\": "./" diff --git a/provider/eloquent/composer.lock b/provider/eloquent/composer.lock index 80b3d3a..e41a86a 100644 --- a/provider/eloquent/composer.lock +++ b/provider/eloquent/composer.lock @@ -4,24 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0cb27bfebe1905ae42d3f22ae6ebea14", + "content-hash": "91c257bf2c0e060500f9fac01ae26933", "packages": [ { "name": "doctrine/inflector", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", - "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^6.2" @@ -29,7 +29,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -71,7 +71,7 @@ "singularize", "string" ], - "time": "2017-07-22T12:18:28+00:00" + "time": "2018-01-09T20:05:19+00:00" }, { "name": "illuminate/container", @@ -609,8 +609,5 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } diff --git a/provider/phalcon/composer.json b/provider/phalcon/composer.json index a0529b2..8aab1f6 100644 --- a/provider/phalcon/composer.json +++ b/provider/phalcon/composer.json @@ -3,11 +3,6 @@ "php": ">=7.0.0", "ext-phalcon": ">=3.3.0" }, - "config": { - "platform": { - "php": "7.0.26" - } - }, "autoload": { "psr-4": { "OrmBench\\Phalcon\\": "./" diff --git a/provider/phalcon/composer.lock b/provider/phalcon/composer.lock index 50ac002..ccb74aa 100644 --- a/provider/phalcon/composer.lock +++ b/provider/phalcon/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8e222a4335d3d1af4dccf406024712b4", + "content-hash": "60c83bcbc861bf8156596593c4304d56", "packages": [], "packages-dev": [], "aliases": [], @@ -16,8 +16,5 @@ "php": ">=7.0.0", "ext-phalcon": ">=3.3.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } diff --git a/provider/propel/composer.json b/provider/propel/composer.json index 85cd697..d87bffd 100644 --- a/provider/propel/composer.json +++ b/provider/propel/composer.json @@ -3,11 +3,6 @@ "php": ">=7.0.0", "propel/propel": "2.0.0-alpha7" }, - "config": { - "platform": { - "php": "7.0.26" - } - }, "autoload": { "psr-4": { "OrmBench\\Propel\\": "./" diff --git a/provider/propel/composer.lock b/provider/propel/composer.lock index 9e7d53a..690139a 100644 --- a/provider/propel/composer.lock +++ b/provider/propel/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "fbf0798698f0426a3bda1ebde809528b", + "content-hash": "cf7bbe4380ce5d13e77e4380029e0a90", "packages": [ { "name": "propel/propel", @@ -251,32 +251,32 @@ }, { "name": "symfony/debug", - "version": "v3.4.3", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245" + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245", - "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245", + "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -303,7 +303,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:14:19+00:00" + "time": "2018-01-03T17:15:19+00:00" }, { "name": "symfony/filesystem", @@ -464,33 +464,33 @@ }, { "name": "symfony/translation", - "version": "v3.4.3", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a" + "reference": "2bb1b9dac38d32c5afb00edc9371b5db4cf6d000" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a", - "reference": "17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a", + "url": "https://api.github.com/repos/symfony/translation/zipball/2bb1b9dac38d32c5afb00edc9371b5db4cf6d000", + "reference": "2bb1b9dac38d32c5afb00edc9371b5db4cf6d000", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/config": "<2.8", + "symfony/config": "<3.4", "symfony/dependency-injection": "<3.4", "symfony/yaml": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/intl": "~3.4|~4.0", "symfony/yaml": "~3.4|~4.0" }, "suggest": { @@ -501,7 +501,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -528,7 +528,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/validator", @@ -684,8 +684,5 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } diff --git a/provider/yii/composer.json b/provider/yii/composer.json index ff31f12..d098f36 100644 --- a/provider/yii/composer.json +++ b/provider/yii/composer.json @@ -9,11 +9,6 @@ "bower-asset/punycode": "*", "bower-asset/inputmask": "*" }, - "config": { - "platform": { - "php": "7.0.26" - } - }, "autoload": { "psr-4": { "OrmBench\\Yii\\": "./" diff --git a/provider/yii/composer.lock b/provider/yii/composer.lock index 1c638e6..201e040 100644 --- a/provider/yii/composer.lock +++ b/provider/yii/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "e8379e3efd764bdc72a10c486964ebc3", + "content-hash": "79c9f80dba27643b9c50bb7364178ebc", "packages": [ { "name": "cebe/markdown", @@ -273,8 +273,5 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [], - "platform-overrides": { - "php": "7.0.26" - } + "platform-dev": [] } From cce7500adbd8471eec812241229f27bc148d21af Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 00:45:36 +0200 Subject: [PATCH 09/15] Fixed install dependencies --- .travis.yml | 4 ++-- provider/doctrine/composer.json | 2 +- provider/doctrine/composer.lock | 4 ++-- provider/eloquent/composer.json | 3 ++- provider/eloquent/composer.lock | 16 ++++++++-------- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d4bf6b..62d1e4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,8 @@ before_install: - if [[ $PROVIDER == "phalcon" ]]; then bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh; fi; install: - - (cd $TRAVIS_BUILD_DIR/provider/$PROVIDER; composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader) - - (cd $TRAVIS_BUILD_DIR; composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader) + - (cd $TRAVIS_BUILD_DIR/provider/$PROVIDER; composer install --no-dev --no-interaction --prefer-dist --no-suggest --optimize-autoloader) + - (cd $TRAVIS_BUILD_DIR; composer install --no-dev --no-interaction --prefer-dist --no-suggest --optimize-autoloader) - phpenv config-add $TRAVIS_BUILD_DIR/ci/benchmark.ini - ls -al `$(phpenv which php-config) --extension-dir` - $(phpenv which php) -v diff --git a/provider/doctrine/composer.json b/provider/doctrine/composer.json index 3b44f37..2388d09 100644 --- a/provider/doctrine/composer.json +++ b/provider/doctrine/composer.json @@ -5,7 +5,7 @@ }, "config": { "platform": { - "php": "7.0.26" + "php": "7.0.25" } }, "autoload": { diff --git a/provider/doctrine/composer.lock b/provider/doctrine/composer.lock index 8a4d5f0..6ff5a7f 100644 --- a/provider/doctrine/composer.lock +++ b/provider/doctrine/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7185e4c6827f83a605d239cadc95a520", + "content-hash": "dcc8b7e57bbe8d5cdc0b33d2aef28f9a", "packages": [ { "name": "doctrine/annotations", @@ -849,6 +849,6 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.0.26" + "php": "7.0.25" } } diff --git a/provider/eloquent/composer.json b/provider/eloquent/composer.json index 5a0a541..5a9bc98 100644 --- a/provider/eloquent/composer.json +++ b/provider/eloquent/composer.json @@ -2,7 +2,8 @@ "require": { "php": ">=7.0.0", "illuminate/database": "5.5.28", - "illuminate/events": "5.5.28" + "illuminate/events": "5.5.28", + "doctrine/inflector": "1.2.0" }, "autoload": { "psr-4": { diff --git a/provider/eloquent/composer.lock b/provider/eloquent/composer.lock index e41a86a..e9b6c04 100644 --- a/provider/eloquent/composer.lock +++ b/provider/eloquent/composer.lock @@ -4,24 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "91c257bf2c0e060500f9fac01ae26933", + "content-hash": "f80739c73982618eb8e2755f1a4d0adf", "packages": [ { "name": "doctrine/inflector", - "version": "v1.3.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.0" }, "require-dev": { "phpunit/phpunit": "^6.2" @@ -29,7 +29,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -71,7 +71,7 @@ "singularize", "string" ], - "time": "2018-01-09T20:05:19+00:00" + "time": "2017-07-22T12:18:28+00:00" }, { "name": "illuminate/container", From d823e3d5e9ddd9a2eb0ca20cd4d2292acbf6f3a9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 00:53:26 +0200 Subject: [PATCH 10/15] Removed no loger needed stuff --- .gitignore | 2 - config/benchmark.ini | 21 ---------- config/grcat | 54 ------------------------ config/my.cnf | 8 ---- docker-compose.yml | 32 --------------- docker/php/image/Dockerfile | 82 ------------------------------------- 6 files changed, 199 deletions(-) delete mode 100644 config/benchmark.ini delete mode 100644 config/grcat delete mode 100644 config/my.cnf delete mode 100644 docker-compose.yml delete mode 100644 docker/php/image/Dockerfile diff --git a/.gitignore b/.gitignore index ee55034..8345dc1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,3 @@ /provider/*/vendor/ /vendor/ - -composer.phar diff --git a/config/benchmark.ini b/config/benchmark.ini deleted file mode 100644 index 2d9ace7..0000000 --- a/config/benchmark.ini +++ /dev/null @@ -1,21 +0,0 @@ -date.timezone = UTC - -error_reporting = E_ALL - -display_errors = 1 -display_startup_errors = 1 - -log_errors = 1 - -memory_limit = -1 -max_execution_time = 300 - -opcache.memory_consumption = 128 -opcache.interned_strings_buffer = 8 -opcache.max_accelerated_files = 4000 -opcache.validate_timestamps = off -opcache.fast_shutdown = 0 -opcache.enable_cli = 1 - -zend.assertions = 1 -assert.exception = 1 diff --git a/config/grcat b/config/grcat deleted file mode 100644 index 72c450c..0000000 --- a/config/grcat +++ /dev/null @@ -1,54 +0,0 @@ -# Default word color -regexp=.+ -colours=green -- - -# Table borders -regexp=[+\-]+[+\-]|[|] -colours=red -- - -# Data in ( ) and ' ' -regexp=\([\w\d,']+\) -colours=white -- - -# Numeric -regexp=\s[\d\.]+\s*($|(?=\|)) -colours=yellow -- - -# Date -regexp=\d{4}-\d{2}-\d{2} -colours=blue -- - -# Time -regexp=\d{2}:\d{2}:\d{2} -colours=cyan -- - -# IP -regexp=(\d{1,3}\.){3}\d{1,3}(:\d{1,5})? -colours=cyan -- - -# Schema -regexp=`\w+` -colours=yellow -- - -# Email -regexp=[\w\.\-_]+@[\w\.\-_]+ -colours=magenta -- - -# Row delimeter when using \G key -regexp=[*]+.+[*]+ -count=stop -colours=white -- - -# Column names when using \G key -regexp=^\s*\w+: -colours=white diff --git a/config/my.cnf b/config/my.cnf deleted file mode 100644 index 4205655..0000000 --- a/config/my.cnf +++ /dev/null @@ -1,8 +0,0 @@ -[mysql] -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect -pager = grcat ~/.grcat diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 7785f48..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: '3.0' - -services: - benchmark: - build: ./docker/php/image - image: php-orm-benchmark:1.0.0 - depends_on: - - mysql - working_dir: '/app' - volumes: - - .:/app:rw - - ./config/grcat:/root/.grcat:ro - - ./config/my.cnf:/root/.my.cnf:ro - - ./config/benchmark.ini:/usr/local/etc/php/conf.d/999-php-orm-benchmark.ini:ro - command: '/bin/bash' - - mysql: - image: mysql/mysql-server:5.7 - volumes: - - ./schema/orm-benchmark.sql:/docker-entrypoint-initdb.d/orm-benchmark.sql:ro - - mysql:/var/lib/mysql - ports: - - "127.0.0.1:3306:3306" - environment: - MYSQL_DATABASE: orm_benchmark - MYSQL_USER: enigma - MYSQL_PASSWORD: secret - MYSQL_ROOT_HOST: "%" - -volumes: - mysql: - driver: local diff --git a/docker/php/image/Dockerfile b/docker/php/image/Dockerfile deleted file mode 100644 index 67ad05e..0000000 --- a/docker/php/image/Dockerfile +++ /dev/null @@ -1,82 +0,0 @@ -FROM php:7.0.26-cli - -LABEL maintainer="Serghei Iakovlev " -LABEL version="1.0.0" - -ENV PHALCON_VERSION=3.3.0 \ - DEBIAN_FRONTEND=noninteractive \ - COMPOSER_HOME=/root/.composer \ - COMPOSER_ALLOW_SUPERUSER=1 \ - PATH=/root/.composer/vendor/bin:$PATH \ - TERM=xterm - -WORKDIR /tmp - -RUN echo exit 101 > /usr/sbin/policy-rc.d \ - && chmod +x /usr/sbin/policy-rc.d \ - && echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup \ - && echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache \ - && apt-get update \ - && apt-get upgrade -y -q \ - && apt-get install -y -q --no-install-recommends apt-utils software-properties-common - -RUN apt-get install -y -q --no-install-recommends \ - build-essential \ - git \ - grc \ - less \ - libcurl3-dev \ - libicu-dev \ - libpcre3-dev \ - libpq-dev \ - libsqlite3-dev \ - libssl-dev \ - libxml2-dev \ - locales \ - mysql-client \ - postgresql-client \ - sqlite3 \ - vim \ - wget \ - zlib1g-dev - -RUN docker-php-ext-configure intl 1>/dev/null \ - && docker-php-ext-install intl 1>/dev/null \ - && docker-php-ext-configure mysqli --with-mysqli=mysqlnd 1>/dev/null \ - && docker-php-ext-install mysqli 1>/dev/null \ - && docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd 1>/dev/null \ - && docker-php-ext-install pdo_mysql 1>/dev/null \ - && docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql 1>/dev/null \ - && docker-php-ext-install pgsql pdo_pgsql zip 1>/dev/null \ - && docker-php-ext-enable opcache \ - && php -m - -RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ - && php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer \ - && rm composer-setup.php \ - && composer --version - -RUN composer global require --no-ansi --prefer-dist --no-interaction --no-suggest "fxp/composer-asset-plugin:~1.4" - -RUN curl -sSLO https://codeload.github.com/phalcon/cphalcon/tar.gz/v$PHALCON_VERSION \ - && tar xzf v$PHALCON_VERSION \ - && cd cphalcon-$PHALCON_VERSION/build \ - && ./install --phpize /usr/local/bin/phpize --php-config /usr/local/bin/php-config 1>/dev/null \ - && echo "extension=`php-config --extension-dir`/phalcon.so" > $PHP_INI_DIR/conf.d/docker-php-ext-phalcon.ini \ - && php --ri phalcon - -RUN apt-get autoremove -y \ - && apt-get autoclean -y \ - && apt-get clean -y \ - && rm -rf \ - /var/lib/apt/lists/* \ - /tmp/* \ - /var/tmp/* \ - /etc/php5 \ - /etc/php/5* \ - /usr/lib/php/20121212 \ - /usr/lib/php/20131226 \ - /var/log \ - /var/cache - -WORKDIR /app \ No newline at end of file From ba157b858ea39c6e1f718b16a8cbc0bed16ac89c Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 00:59:50 +0200 Subject: [PATCH 11/15] propel require symfony console, symfony console require symfony debug, symfony debug require php 7.1 --- provider/propel/composer.json | 3 ++- provider/propel/composer.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/provider/propel/composer.json b/provider/propel/composer.json index d87bffd..8672a59 100644 --- a/provider/propel/composer.json +++ b/provider/propel/composer.json @@ -1,7 +1,8 @@ { "require": { "php": ">=7.0.0", - "propel/propel": "2.0.0-alpha7" + "propel/propel": "2.0.0-alpha7", + "symfony/debug": "3.4.3" }, "autoload": { "psr-4": { diff --git a/provider/propel/composer.lock b/provider/propel/composer.lock index 690139a..b998397 100644 --- a/provider/propel/composer.lock +++ b/provider/propel/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "cf7bbe4380ce5d13e77e4380029e0a90", + "content-hash": "504a1184ca28628858641b6a0ed34269", "packages": [ { "name": "propel/propel", @@ -251,32 +251,32 @@ }, { "name": "symfony/debug", - "version": "v4.0.3", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", - "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", + "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245", + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": "<3.4" + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -303,7 +303,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:15:19+00:00" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/filesystem", From 14f870a4523b9c606a58906099ef864fcb3ac9d6 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 01:06:20 +0200 Subject: [PATCH 12/15] Tune up Yii setup --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 62d1e4c..e83b8d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ env: global: - CC="ccache gcc" - PHALCON_VERSION=v3.3.0 + - PATH=/root/.composer/vendor/bin:$PATH # TODO - HAS_CACHING_METADATA_SUPPORT=0 matrix: @@ -51,6 +52,7 @@ before_install: - phpenv config-rm xdebug.ini || true - if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi; - if [[ $PROVIDER == "phalcon" ]]; then bash $TRAVIS_BUILD_DIR/ci/install_phalcon.sh; fi; + - if [[ $PROVIDER == "yii" ]]; then composer global require --prefer-dist --no-interaction --no-suggest "fxp/composer-asset-plugin:~1.4"; fi; install: - (cd $TRAVIS_BUILD_DIR/provider/$PROVIDER; composer install --no-dev --no-interaction --prefer-dist --no-suggest --optimize-autoloader) From 3d9db834f7dc0f49c50bede3896b176752b03bf1 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 01:26:20 +0200 Subject: [PATCH 13/15] Looks like Propel needs the hardcoded PHP version too :/ --- provider/propel/composer.json | 8 ++++++-- provider/propel/composer.lock | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/provider/propel/composer.json b/provider/propel/composer.json index 8672a59..616ce09 100644 --- a/provider/propel/composer.json +++ b/provider/propel/composer.json @@ -1,8 +1,12 @@ { "require": { "php": ">=7.0.0", - "propel/propel": "2.0.0-alpha7", - "symfony/debug": "3.4.3" + "propel/propel": "2.0.0-alpha7" + }, + "config": { + "platform": { + "php": "7.0.25" + } }, "autoload": { "psr-4": { diff --git a/provider/propel/composer.lock b/provider/propel/composer.lock index b998397..6af438b 100644 --- a/provider/propel/composer.lock +++ b/provider/propel/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "504a1184ca28628858641b6a0ed34269", + "content-hash": "3c8053fe9f3a9acd65cf84b0aa842f35", "packages": [ { "name": "propel/propel", @@ -251,32 +251,32 @@ }, { "name": "symfony/debug", - "version": "v3.4.3", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245" + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245", - "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245", + "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -303,7 +303,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:14:19+00:00" + "time": "2018-01-03T17:15:19+00:00" }, { "name": "symfony/filesystem", @@ -684,5 +684,8 @@ "platform": { "php": ">=7.0.0" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "7.0.25" + } } From 3eef10a858c2e29d350c87027d55e9b50cc677a9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 01:38:29 +0200 Subject: [PATCH 14/15] Fixed Propel dependencies --- provider/propel/composer.lock | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/provider/propel/composer.lock b/provider/propel/composer.lock index 6af438b..bfcaa4f 100644 --- a/provider/propel/composer.lock +++ b/provider/propel/composer.lock @@ -251,32 +251,32 @@ }, { "name": "symfony/debug", - "version": "v4.0.3", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", - "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", + "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245", + "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": "<3.4" + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -303,7 +303,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-01-03T17:15:19+00:00" + "time": "2018-01-03T17:14:19+00:00" }, { "name": "symfony/filesystem", @@ -464,33 +464,33 @@ }, { "name": "symfony/translation", - "version": "v4.0.3", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2bb1b9dac38d32c5afb00edc9371b5db4cf6d000" + "reference": "17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2bb1b9dac38d32c5afb00edc9371b5db4cf6d000", - "reference": "2bb1b9dac38d32c5afb00edc9371b5db4cf6d000", + "url": "https://api.github.com/repos/symfony/translation/zipball/17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a", + "reference": "17b5962d252b2d6d1d37a2485ebb7ddc5b2bef0a", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/config": "<3.4", + "symfony/config": "<2.8", "symfony/dependency-injection": "<3.4", "symfony/yaml": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", + "symfony/config": "~2.8|~3.0|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/intl": "~3.4|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", "symfony/yaml": "~3.4|~4.0" }, "suggest": { @@ -501,7 +501,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -528,7 +528,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/validator", From 1c7557775915817201da0f539282da4dc4fd835d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 10 Jan 2018 01:26:31 +0200 Subject: [PATCH 15/15] Update README.md --- README.md | 236 +++++++----------------------------------------------- 1 file changed, 28 insertions(+), 208 deletions(-) diff --git a/README.md b/README.md index dc67f8f..fd0509e 100644 --- a/README.md +++ b/README.md @@ -1,221 +1,42 @@ -# PHP ORM Benchmark - -The Docker based project to facilitate PHP ORM benchmarks. - -## Contents [↑](#php-orm-benchmark) - -* [Requirements](#requirements-) -* [ORMs to Benchmark](#orms-to-benchmark-) -* [Getting Started](#getting-started-) - * [Running Benchmark](#running-benchmark-) - * [Results](#results-) - * [Benchmarking Environment](#benchmarking-environment-) - * [First run](#first-run-) - * [Insert a record to the Database](#insert-a-record-to-the-database-) - * [Get first record with relation](#get-first-record-with-relation-) - * [10-fold method call](#10-fold-method-call-) - * [Insert a record to the Database](#insert-a-record-to-the-database--1) - * [Get first record with relation](#get-first-record-with-relation--1) - * [First run with metadata caching](#first-run-with-metadata-caching-) - * [Get first record with relation](#get-first-record-with-relation--2) - * [10-fold method call with metadata caching](#10-fold-method-call-with-metadata-caching-) - * [Get first record with relation](#get-first-record-with-relation--3) -* [Contributing](#contributing-) -* [Discussion](#discussion-) -* [References](#references-) -* [License](#license-) - -## Requirements [↑](#php-orm-benchmark) - -* Linux or BDS System -* Docker CE/EE >= 17.09.0 -* Docker Compose >= 1.17 -* PHP >= 7.0 -* Composer - -## ORMs to Benchmark [↑](#php-orm-benchmark) +# PHP ORM Benchmark [![Build Status](https://travis-ci.org/sergeyklay/php-orm-benchmark.svg?branch=master)](https://travis-ci.org/sergeyklay/php-orm-benchmark) -* Phalcon 3.3.0 -* Propel ORM 2.0.0-alpha7 -* Eloquent 5.5.28 -* CakePHP ORM 3.5.10 -* Yii ActiveRecord 2.0.13.1 -* Doctrine ORM 2.5.14 -* PHP ActiveRecord 1.2.0 - -## Getting Started [↑](#php-orm-benchmark) - -First you have to build the benchmark application. Go to project root and run command as follows: - -```sh -git clone git@github.com:sergeyklay/php-orm-benchmark.git -cd php-orm-benchmark -docker-compose build --force-rm --no-cache -``` - -I advise you to rely on [Composer](https://getcomposer.org) 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: - -```sh -$ 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: - -```sh -php composer.phar install -``` - -**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: - -```sh -docker-compose run benchmark -``` - -### Running Benchmark [↑](#php-orm-benchmark) - -To run benchmark simple run command as follows: - -```sh -php run -``` - -Available providers are: - -* `phalcon` -* `propel` -* `eloquent` -* `cake` -* `yii` -* `doctrine` -* `activerecord` - -Available tests are: - -* `create` -* `read` - -To run benchmark multiple times use: +The benchmark to compare different ORM solutions for PHP. -```sh -php run -``` +Initially this project used Docker to facilitate PHP ORM benchmarks. But after [repeated](https://github.com/sergeyklay/php-orm-benchmark/pull/12) [comments](https://github.com/sergeyklay/php-orm-benchmark/issues/7) I decided to transfer the benchmarks to [Travis CI](https://travis-ci.org/sergeyklay/php-orm-benchmark). -Some ORMs rely (depends) on models metadata caching. Thus, to avoid [controversy](https://github.com/sergeyklay/php-orm-benchmark/issues/4) -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: +So everyone [can see the results](https://travis-ci.org/sergeyklay/php-orm-benchmark) or run them again. Actually I've enabled the daily [cron job on Travis CI](https://docs.travis-ci.com/user/cron-jobs/). -```sh -php run 1 -``` +NOTE: Some ORMs rely (depends) on models metadata caching. Thus, to avoid [controversy](https://github.com/sergeyklay/php-orm-benchmark/issues/4) there is an ability to create and run test with metadata caching support. -To destroy the application use the following command from the host system: +## ORMs to Benchmark -```sh -docker-compose down -docker volume rm phpormbenchmark_mysql -``` - -## Results [↑](#php-orm-benchmark) - -These are my benchmarks, not yours. **I encourage you to run on your (production equivalent) environments.** -By sharing underlying software stacks, the benchmark results vary only according to the host machine's hardware specs and differing code implementations. - -### Benchmarking Environment [↑](#php-orm-benchmark) - -* Debian GNU/Linux 8.10 (jessie) 64bit (Docker) -* PHP 7.0.26 -* Zend OPcache 7.0.26 -* MySQL 5.7 - -### First run [↑](#php-orm-benchmark) - -#### Insert a record to the Database [↑](#php-orm-benchmark) - -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | Method | -|-------------------|--------------------:|------------------:|-------------------------:|--------------| -| Doctrine | 180.52 | 764.05 | 1,992,804.41 | `flush` | -| CakePHP | 288.97 | 836.86 | 1,546,380.41 | `save` | -| Eloquent | 130.20 | 520.95 | 1,530,852.41 | `save` | -| Propel | 101.60 | 278.77 | 977,372.41 | `save` | -| Yii | 40.72 | 225.01 | 1,180,652.41 | `save` | -| PHP ActiveRecord | 28.12 | 118.91 | 804,852.41 | `save` | -| Phalcon | 9.13 | 32.66 | 720,812.41 | `save` | - -#### Get first record with relation [↑](#php-orm-benchmark) - -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | Method | -|-------------------|--------------------:|------------------:|-------------------------:|--------------| -| Doctrine | 202.51 | 798.64 | 2,028,596.41 | `findOneBy` | -| CakePHP | 282.98 | 977.05 | 1,690,308.41 | `find` | -| Eloquent | 127.85 | 559.12 | 1,570,316.41 | `firstOrFail`| -| Propel | 154.12 | 725.33 | 1,435,020.41 | `findPk` | -| Yii | 69.66 | 325.98 | 1,284,428.41 | `findOne` | -| PHP ActiveRecord | 28.19 | 57.23 | 742,100.41 | `first` | -| Phalcon | 10.79 | 67.12 | 756,092.41 | `findFirst` | - -### 10-fold method call [↑](#php-orm-benchmark) - -#### Insert a record to the Database [↑](#php-orm-benchmark) - -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | Method | -|-------------------|--------------------:|------------------:|-------------------------:|--------------| -| Doctrine | 19.36 | 78.26 | 2,011,436.41 | `flush` | -| CakePHP | 24.61 | 83.72 | 1,546,380.41 | `save` | -| Eloquent | 14.80 | 52.13 | 1,530,852.41 | `save` | -| Propel | 9.05 | 28.16 | 979,996.41 | `save` | -| Yii | 5.46 | 23.94 | 1,195,028.41 | `save` | -| PHP ActiveRecord | 4.98 | 11.95 | 804,852.41 | `save` | -| Phalcon | 2.13 | 3.33 | 721,420.41 | `save` | - -#### Get first record with relation [↑](#php-orm-benchmark) - -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | Method | -|-------------------|--------------------:|------------------:|-------------------------:|--------------| -| Doctrine | 18.96 | 83.29 | 2,063,724.41 | `findOneBy` | -| CakePHP | 29.33 | 97.70 | 1,690,308.41 | `find` | -| Eloquent | 13.55 | 55.91 | 1,570,316.41 | `firstOrFail`| -| Propel | 15.44 | 73.15 | 1,441,348.41 | `findPk` | -| Yii | 8.03 | 35.40 | 1,313,084.41 | `findOne` | -| PHP ActiveRecord | 2.95 | 5.72 | 742,100.41 | `first` | -| Phalcon | 1.54 | 15.54 | 846,444.41 | `findFirst` | - -### First run with metadata caching [↑](#php-orm-benchmark) - -#### Get first record with relation [↑](#php-orm-benchmark) - -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | MetaData Storage | -|-------------------|--------------------:|------------------:|-------------------------:|------------------| -| Doctrine | 145.61 | 264.44 | 2,033,836.41 | File System | -| CakePHP | 273.66 | 1,075.52 | 1,793,772.41 | File System | -| Phalcon | 18.69 | 60.75 | 750,268.41 | File System | - -### 10-fold method call with metadata caching [↑](#php-orm-benchmark) +* CakePHP ORM 3.5.10 +* Doctrine ORM 2.5.14 +* Eloquent 5.5.28 +* PHP ActiveRecord 1.2.0 +* Phalcon 3.3.0 +* Propel ORM 2.0.0-alpha7 +* Yii ActiveRecord 2.0.13.1 -#### Get first record with relation [↑](#php-orm-benchmark) +## Benchmarking Environment -| ORM | Elapsed time (ms) | Used memory (KiB) | Total memory usage (KiB) | MetaData Storage | -|-------------------|--------------------:|------------------:|-------------------------:|------------------| -| Doctrine | 15.65 | 29.87 | 2,068,964.41 | File System | -| CakePHP | 30.18 | 107.55 | 1,793,772.41 | File System | -| Phalcon | 2.27 | 14.90 | 840,620.41 | File System | +* Ubuntu 14.04.5 (Trusty) 64bit (Travis CI) +* PHP 7.0, 7.1, 7.2, 7.3 +* Zend OPcache 7.0, 7.1, 7.2, 7.3 +* MySQL 5.6 -## Contributing [↑](#php-orm-benchmark) +## What we test -The source for this extension is available on [GitHub](https://github.com/sergeyklay/php-orm-benchmark). If anyone feels that there is -something missing or would like to suggest improvements please [open a new issue](https://github.com/sergeyklay/php-orm-benchmark/issues) -or send a pull request. +* Insert a record to the Database +* Get first record with relation +* Insert a record to the Database (10-fold method call) +* Get first record with relation (10-fold method call) -## Discussion [↑](#php-orm-benchmark) +## Contributing -There is an `#general` channel on the Phalcon [Discord Server](https://discord.gg/PNFsSsr). -If you would like to discuss an idea or need help or have other feedback you can usually find me (`@klay`) idling there. +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](https://github.com/sergeyklay/php-orm-benchmark/issues) or send a pull request. -## References [↑](#php-orm-benchmark) +## References * [Eloquent ORM](https://laravel.com/docs/5.5/eloquent) * [Phalcon ORM](https://docs.phalconphp.com/en/3.2/db-models) @@ -225,10 +46,9 @@ If you would like to discuss an idea or need help or have other feedback you can * [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html) * [PHP ActiveRecord](http://www.phpactiverecord.org/projects/main/wiki) -## License [↑](#php-orm-benchmark) +## License -The "PHP ORM Benchmark" is open source software licensed under the MIT License. -See the [LICENSE](https://github.com/sergeyklay/php-orm-benchmark/blob/master/LICENSE) file for more. +The "PHP ORM Benchmark" is open source software licensed under the MIT License. See the [LICENSE](https://github.com/sergeyklay/php-orm-benchmark/blob/master/LICENSE) file for more. ---