Code Monkey home page Code Monkey logo

Comments (22)

francoispluchino avatar francoispluchino commented on May 20, 2024

The research is slow only in the first analysis of the repository, because the plugin looks for all available versions. After all the versions are cached and only the new versions are recovered (native system of the Composer VCS Repository).

I am always taking optimization, but the problem with your proposal, that is it is impossible to recover the dependencies, because they are shown only in the file bower.json or package.json.

If you have a solution for a performance optimization, while retaining the complete management of dependencies, I'm interested.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

PS: the limit of Github API can be bypassed with a token of authentication.

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Please have a look at the linked commit - the complete management of dependencies still works.

If you want I can try to create a pull request...

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

I watched your PR justly, is the least of it! :-)
On the other hand, I went next to the nsams/composer@53fc1cb#diff-0937c306b2bc60bd12540a6b8faa462fR151 which retrieves the file bower.json... mea culpa!

I think it would be much more interesting to directly improve the performance of Composer VCS system.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

@nsams Given that it is in Composer\Repository\VcsRepository::initialize() that the Lazy Loading should be done, and that for assets, there is a class AssetVcsRepository that extends and override VcsRepository::initialize(), I think we can do it directly here for the assets.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

@nsams I may be a solution for make the lazing loading, I'll try tomorrow.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

@nsams I just finished the proof of concept, and it is achievable!

The compatibility is always kept with the VCS repositories, but it imports only the informations of asset package (JSON file) only when necessary.

More the dependencies are precise, least there will requests, but the requests below cannot be deleted:

  • Retrieving the informations of asset package (JSON file) of root branch
  • Retrieving the list of tags
  • Retrieving the list of branches

You should feel a big improvement in performance.

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Great to hear that!

My tries on that weren't that successful, but glad to hear you found a solution...

now i'm waiting eagerly for your push :D

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

@nsams I finish the cleaning up and tests, and it will be good!

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

It's done! (see b87d885)

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Looking good. However you have the same problem my implementation has:
take bootstrap as example, it requires jquery >= 1.9.0. That results in jquery bower.json loads for all versions >= 1.9.0 (13 at the moment).

As far as I could see this is because of the Pool::$whitelist which is filled with required packages in RuleSetGenerator::whitelistFromPackage.
Now I have no idea what this whitelist is good for, so I stopped at this point.

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Further testing showed that the lazy loading doesn't when updating already installed vendors. The bootstrap example (which depends on jquery) causes all (20) tags to load.

"require": {
    "bower-asset/bootstrap": "3.1.1"
}

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

This is what I stated above, more you specify the version, less there will be of request.

For have a single request for jquery, you can make:

{
   "require": {
        "bower-asset/bootstrap": "3.1.1",
        "bower-asset/jquery": "2.1.1"
    }
}

Output:

Loading composer repositories with package information
Installing dependencies (including require-dev)
Reading bower.json of bower-asset/bootstrap (v3.1.1)
Importing tag v3.1.1 (3.1.1.0)
Reading bower.json of bower-asset/jquery (2.1.1)
Importing tag 2.1.1 (2.1.1.0)
  - Installing bower-asset/jquery (2.1.1)
    Loading from cache
    Extracting archive

  - Installing bower-asset/bootstrap (v3.1.1)
    Loading from cache
    Extracting archive

Writing lock file
Generating autoload files

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Ah, that helps. Not very convenient though.

Testing just showed me that removing a dependency an running composer update (which will delete the dependency from vendor) will load all versions of this page.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

For the first point, I know, but I do not see how to change that.
For the second point, I have reproduces the behavior, I'll watch.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

The behavior is always present for each update (and not only when you delete a dependency).
The problem is from the method Composer\DependencyResolver\RuleSetGenerator::whitelistFromPackage and Composer\DependencyResolver\RuleSetGenerator::addRulesForPackage

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Do you know more about this whitelist? What does it do?

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

This is to include all dependencies in the queue, otherwise, the dependencies of dependencies are not resolved.

from composer-asset-plugin.

nsams avatar nsams commented on May 20, 2024

Yes, the Pool checks in computeWhatProvides if the package is in the whitelist, and if not it is skipped. So far I get it.

But why is this whitelist needed? which packages are not in the whitelist and must be skipped?

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

I wonder me the same question, I think it would be better to ask the question directly to creators of Composer.

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

2 issues on improving performance for Composer:

from composer-asset-plugin.

francoispluchino avatar francoispluchino commented on May 20, 2024

The issue #52 improves significantly the performance for the update.

from composer-asset-plugin.

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.