Giter Site home page Giter Site logo

Performance improvements? about pharbuilder HOT 6 OPEN

macfja avatar macfja commented on August 12, 2024
Performance improvements?

from pharbuilder.

Comments (6)

MacFJA avatar MacFJA commented on August 12, 2024

Hi,

I have in the past an issue with the compression of a Phar when it's not done file by file (see my comment here: https://github.com/MacFJA/PharBuilder/blob/master/app/PharBuilder.php#L538)
(I don't know if the issue is still present in later PHP version. I can make some tests to check it.)

BTW, I like your solution ; but it's not very compatible with Windows, can you at least add a test on PHP_OS before running ulimit?

from pharbuilder.

jiaojie1989 avatar jiaojie1989 commented on August 12, 2024

Yeah, I will try to add a test on PHP_OS later.
Thanks.

from pharbuilder.

theofidry avatar theofidry commented on August 12, 2024

I have in the past an issue with the compression of a Phar when it's not done file by file

@MacFJA do you have an example where you have this? I saw a similar suggestion on Box2 and I tried to apply it but only saw major performance degradation (box-project/box#29).

from pharbuilder.

MacFJA avatar MacFJA commented on August 12, 2024

@theofidry

Here some the test I run:

git clone https://github.com/jiaojie1989/PharBuilder.git --depth 2
git clone https://github.com/symfony/symfony-standard.git --branch v3.0.0 --depth 1

cd PharBuilder
git checkout 5fb2559c60a288784d8f377c6b7f0ac81a2573c4
composer install

cd ..

cd symfony-standard
composer install --no-scripts

php -d phar.readonly=0 ../PharBuilder/bin/phar-builder.php package -z --name app.phar -o ../ -s no -e web/app.php

The results:

OS: OS X (10.9.5)
Kernel: Darwin 13.4.0
PHP: 7.1.11
Ulimit: 4864
Result: Fail -> Message from the cli: "unable to create temporary file"

OS: Ubuntu 16.04
Kernel: Linux 4.13.0
PHP: 7.0.22
Ulimit: 4864 (previous value was 1024, raised to match OS X and validate the code test)
Result: Fail -> Message from the cli: "unable to create temporary file"

OS: OS X (10.9.5)
Kernel: Darwin 13.4.0
PHP: 5.6.31
Ulimit: 4864
Result: Fail -> Message from the cli: "unable to create temporary file"


Related PHP bugs:


I'm interested in results in other cases.

from pharbuilder.

theofidry avatar theofidry commented on August 12, 2024

Hm so if I'm understanding this right you're not doing this for performance reasons but because the Phar::compress() hits a OS limitation about the number of files open? That's savage :/

Well I guess a workaround would be to have different compressing strategies depending of the number of files added... Still sounds like a pretty nasty bug that could be fixed at the PHAR extension level.

On the same note it's impressive to see the difference between buildFromIterator() and addFromString() (the former being 30x times faster in my case)

from pharbuilder.

theofidry avatar theofidry commented on August 12, 2024

Heads up: I actually manage to get it working on Box by bumping the OS limit of the max number of files opened (which is reverted afterwards obviously): https://github.com/humbug/box/blob/master/src/Console/Command/Compile.php#L624

from pharbuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.