yii2-app-basic: Asset installation of 2.0.13 very slow with cap installed

What steps will reproduce the problem?

Install the basic-app with global fxp/cap installation

What’s expected?

  • super-fast installation (with filled caches)

What do you get instead?

  • slow installation, due to a lot of API requests

Additional info

Q A
Yii vesion any
PHP version any
Operating system any

Introduced by https://github.com/yiisoft/yii2-app-basic/commit/395e9c7faeba1094084d2308e00b519e9f0f1fd4

Whether you like the asset-plugin or not is no question here, but removing all the stuff introduced without BC-break in https://github.com/yiisoft/yii2-app-basic/commit/120d35506e411e575ee07aac900d7394b5b7386c - one day earlier, just makes no sense to me.

If you have a global cap installation you can not use this anymore, please do not force this onto the developers, I have plenty of reasons not to use AP in many projects. The settings and info have no effect, if do not have fxp/cap installed, they simply take care that things work as before, just almost as fast as with AP.

Such a removal has to be done in 2.1 not earlier. I’d assume the majority of users still have the plugin installed, since it was the recommended way for years.

If you want to disable fxp/cap, you could add a config option to composer.json for that, but I think this should also be the developers choice.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (25 by maintainers)

Commits related to this issue

Most upvoted comments

@SilverFire @samdark the plugin is disabled, but it should still have a useable config

That’s true but only to a certain degree, since AP will not be used, if you have c-a-p installed.

But it will. c-a-p will feed composer the bower/npm packages it finds, but composer will also get those packages from asset-packagist, and both sets of packages will end up in composer’s dependency solver. That’s why you get bugs like https://github.com/hiqdev/asset-packagist/issues/72

But subtle bugs like that are exactly why it’s not a good idea to have both c-a-p and asset-packagist active in a project. Plus you’ll get inconsistent behavior if you’re working with someone else who doesn’t have c-a-p installed.

@nkovacs With which version of the asset-plugin did you run your benchmarks? The bower URL was updated in 1.4.2 - if you are below that you are loosing a lot of time.

My benchmarks for the yii2-basic-app are (2nd run):

FXP_ASSET__ENABLED=0 composer update --profile
[157.9MB/2.32s] Memory usage: 157.87MB (peak: 213.47MB), time: 2.32s

FXP_ASSET__ENABLED=1 composer update --profile
[159.9MB/3.98s] Memory usage: 159.87MB (peak: 229.58MB), time: 3.98s

with asset-packagist, c-a-p disabled:

Memory usage: 173.83MB (peak: 251.52MB), time: 2.58s
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.67
Maximum resident set size (kbytes): 281276

with asset-packagist, c-a-p enabled and set to use git, last 2 days (like the previous config), first run:

Memory usage: 176.21MB (peak: 255.26MB), time: 123.08s
Elapsed (wall clock) time (h:mm:ss or m:ss): 2:03.17
Maximum resident set size (kbytes): 285460

second run:

Memory usage: 176.22MB (peak: 255.44MB), time: 72.39s
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:12.58
Maximum resident set size (kbytes): 285444

More than a minute vs 2.5 seconds.

without using git, i.e. if you have c-a-p installed and you try to use this template:

Memory usage: 176.28MB (peak: 255.33MB), time: 99.27s
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:39.36
Maximum resident set size (kbytes): 285656

Wait, wasn’t git supposed to be faster?

In all cases I ran composer update --profile without deleting vendor, and there were no updates. Feel free to benchmark other cases, but I think this is convincing enough.

So clearly the plugin should be disabled by default. If someone wants to use c-a-p, they can remove asset-packagist and re-enable the plugin in their composer.json.

Should be…

"config":{
  "fxp-asset":{		
    "enabled": true
  }
}

or false 😄

Sorry, I don’t get it, what do you mean with “that”? I am just saying that there was a perfect configuration for all use-cases, now an essential speed upgrade is removed for no reason.