Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Optimize build speed by 97% or more #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Optimize build speed by 97% or more #27

wants to merge 1 commit into from

Conversation

Toflar
Copy link

@Toflar Toflar commented Feb 21, 2018

Hi there!

My colleague informed me that building the phar file takes about 4 minutes. I couldn't believe this so I quickly looked into what the issue was. Blackfire told me 97% of all the time is needed at Phar::addFromString(). So I thought why not just write it all to a temporary directory, make it "lazy" and then add all of the files to the phar file at once using Phar::buildFromDirectory().
Turns out this works just fine for me and build time went down from 4 min 5 s to 7.05 s 😎

I couldn't add tests because the supported php versions and the used phpunit is so old that I sort of cannot get it to work without some serious changes. Do you plan to update the tests on master and update to a decent phpunit version? If so, I'll be happy to add tests for this stuff here.

Hope to help :-)

PS: Blackfire comparison: https://blackfire.io/profiles/compare/2d79d513-2460-4010-a797-914ba7237a7f/graph

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant