Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

test to install symfony deps using PHP and HHVM

View test.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/bash
 
# Instructions
# run: php composer.phar create-project symfony/framework-standard-edition test 2.4.3 --no-scripts
# cd test and download and run this script
 
if [ ! -f composer.phar ]; then
curl -sS https://getcomposer.org/installer | php
fi
 
echo Deleting vendor...
rm -rf vendor
 
echo PHP test
 
time php composer.phar install --prefer-dist --no-scripts
 
echo Deleting vendor...
rm -rf vendor
 
echo HHVM test
 
time hhvm composer.phar install --prefer-dist --no-scripts

➜ test ../test.sh
#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /home/pascal/test/composer.phar
Use it: php composer.phar
Deleting vendor...
PHP test
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

  • Installing doctrine/lexer (v1.0)
    Loading from cache

  • Installing doctrine/annotations (v1.1.2)
    Loading from cache

  • Installing doctrine/cache (v1.3.0)
    Loading from cache

  • Installing twig/twig (v1.15.1)
    Loading from cache

  • Installing symfony/symfony (v2.4.3)
    Loading from cache

  • Installing symfony/icu (v1.2.1)
    Loading from cache

  • Installing psr/log (1.0.0)
    Loading from cache

  • Installing doctrine/inflector (v1.0)
    Loading from cache

  • Installing doctrine/collections (v1.2)
    Loading from cache

  • Installing doctrine/common (v2.4.1)
    Loading from cache

  • Installing jdorn/sql-formatter (v1.2.17)
    Loading from cache

  • Installing doctrine/dbal (v2.4.2)
    Loading from cache

  • Installing doctrine/doctrine-bundle (v1.2.0)
    Loading from cache

  • Installing doctrine/orm (v2.4.2)
    Loading from cache

    Skipped installation of bin bin/doctrine for package doctrine/orm: name conflicts with an existing file
    Skipped installation of bin bin/doctrine.php for package doctrine/orm: name conflicts with an existing file

  • Installing incenteev/composer-parameter-handler (v2.1.0)
    Loading from cache

  • Installing sensio/distribution-bundle (v2.3.4)
    Loading from cache

  • Installing sensio/framework-extra-bundle (v3.0.0)
    Loading from cache

  • Installing sensio/generator-bundle (v2.3.4)
    Loading from cache

  • Installing kriswallsmith/assetic (v1.1.2)
    Loading from cache

  • Installing symfony/assetic-bundle (v2.3.0)
    Loading from cache

  • Installing monolog/monolog (1.8.0)
    Loading from cache

  • Installing symfony/monolog-bundle (v2.5.1)
    Loading from cache

  • Installing swiftmailer/swiftmailer (v5.1.0)
    Loading from cache

  • Installing symfony/swiftmailer-bundle (v2.3.7)
    Loading from cache

  • Installing twig/extensions (v1.0.1)
    Loading from cache

kriswallsmith/assetic suggests installing leafo/lessphp (Assetic provides the integration with the lessphp LESS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp (Assetic provides the integration with the scssphp SCSS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp-compass (Assetic provides the integration with the SCSS compass plugin)
kriswallsmith/assetic suggests installing ptachoire/cssembed (Assetic provides the integration with phpcssembed to embed data uris)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
Generating autoload files

real 0m2.517s
user 0m0.909s
sys 0m0.579s
Deleting vendor...
HHVM test
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

  • Installing doctrine/lexer (v1.0)
    Loading from cache

  • Installing doctrine/annotations (v1.1.2)
    Loading from cache

  • Installing doctrine/cache (v1.3.0)
    Loading from cache

  • Installing twig/twig (v1.15.1)
    Loading from cache

  • Installing symfony/symfony (v2.4.3)
    Loading from cache

  • Installing symfony/icu (v1.2.1)
    Loading from cache

  • Installing psr/log (1.0.0)
    Loading from cache

  • Installing doctrine/inflector (v1.0)
    Loading from cache

  • Installing doctrine/collections (v1.2)
    Loading from cache

  • Installing doctrine/common (v2.4.1)
    Loading from cache

  • Installing jdorn/sql-formatter (v1.2.17)
    Loading from cache

  • Installing doctrine/dbal (v2.4.2)
    Loading from cache

  • Installing doctrine/doctrine-bundle (v1.2.0)
    Loading from cache

  • Installing doctrine/orm (v2.4.2)
    Loading from cache

    Skipped installation of bin bin/doctrine for package doctrine/orm: name conflicts with an existing file
    Skipped installation of bin bin/doctrine.php for package doctrine/orm: name conflicts with an existing file

  • Installing incenteev/composer-parameter-handler (v2.1.0)
    Loading from cache

  • Installing sensio/distribution-bundle (v2.3.4)
    Loading from cache

  • Installing sensio/framework-extra-bundle (v3.0.0)
    Loading from cache

  • Installing sensio/generator-bundle (v2.3.4)
    Loading from cache

  • Installing kriswallsmith/assetic (v1.1.2)
    Loading from cache

  • Installing symfony/assetic-bundle (v2.3.0)
    Loading from cache

  • Installing monolog/monolog (1.8.0)
    Loading from cache

  • Installing symfony/monolog-bundle (v2.5.1)
    Loading from cache

  • Installing swiftmailer/swiftmailer (v5.1.0)
    Loading from cache

  • Installing symfony/swiftmailer-bundle (v2.3.7)
    Loading from cache

  • Installing twig/extensions (v1.0.1)
    Loading from cache

kriswallsmith/assetic suggests installing leafo/lessphp (Assetic provides the integration with the lessphp LESS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp (Assetic provides the integration with the scssphp SCSS compiler)
kriswallsmith/assetic suggests installing leafo/scssphp-compass (Assetic provides the integration with the SCSS compass plugin)
kriswallsmith/assetic suggests installing ptachoire/cssembed (Assetic provides the integration with phpcssembed to embed data uris)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
Generating autoload files

real 0m3.630s
user 0m2.113s
sys 0m1.009s

stof commented

Try benchmarking them in --dry-run mode to skip the installation. All the time spent downloading archives is about network.

Also, the dependency solving is much more complex in composer update than in composer install. This is the command where HHVM will probably win (for install, the solving is smaller, so the JIT may not have enough time to warm up and then catch up with the initial warming overhead)

After the yesterday conversation in twitter, i just spend some time making more tests and investigations.

Speaking with @danslo dont exists any benefit in run code in CLI with HHVM except long term executions, because the JIT cache is just stored in ram and every run need to recreate it, the HHVM team is working in solving this but currently, looks like dont have seens execute composer under HHVM by performance reasons

In my Macbook Air under hhvm-vagrant and KnpIpsum repository, and a previous standard installation with all in cache, my results are:

PHP 5.3.10-1ubuntu3.11
rm -rf vendor/ && time php composer.phar install --prefer-dist --no-scripts > /dev/null

real    0m3.724s
real    0m3.485s
real    0m3.359s
real    0m3.234s
real    0m3.510s

HipHop VM 3.1.0-dev (rel)
rm -rf vendor/ && time hhvm composer.phar install --prefer-dist --no-scripts > /dev/null

real    0m3.727s
real    0m3.517s
real    0m3.549s
real    0m3.742s
real    0m3.668s

With --dry-run as @stof suggested, the results are very different:

PHP 5.3.10-1ubuntu3.11
rm -rf vendor/ && time php composer.phar install --prefer-dist --no-scripts --dry-run > /dev/null

real    0m0.573s
real    0m0.514s
real    0m0.531s
real    0m0.574s
real    0m0.529s

HipHop VM 3.1.0-dev (rel)
rm -rf vendor/ && time hhvm composer.phar install --prefer-dist --no-scripts --dry-run > /dev/null

real    0m1.789s
real    0m1.860s
real    0m1.863s
real    0m1.696s
real    0m1.709s
Owner

So, we agree that running composer install with HHVM results in slower execution than PHP. I understand the issue with the JIT cache on CLI. But in my tests, HHVM takes longer than PHP, much longer than the JIT initialization. In the best case scenario, HHVM should be the same or roughly the same speed as PHP, not many seconds slower. The bigger the number of deps, the larger the gap is.

My point is, lots of people recommend to run composer with HHVM which is fine if you are using it for doing the update. But if you are using it for install then it will run slower. So doing the aliasing to always run composer with HHVM is not a good idea at the moment, until the HHVM team improves the performance around whatever composer install is doing.

Owner

@stof adding --dry-run clearly shows a major improvement in execution time, but why would I do that? Nobody will run composer with --dry-run. I want to test a real use case, not a theoretic one.

Hack vs PHP (Computer Language Benchmarks Game):

http://benchmarksgame.alioth.debian.org/u64q/hack.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.