rvl / bower2nix

Generate nix expressions to fetch bower dependencies.
Other
6 stars 10 forks source link

Invocation of example app takes nearly a minute #2

Open Profpatsch opened 8 years ago

Profpatsch commented 8 years ago
{
  "name": "my-web-app",
  "dependencies": {
    "angular": "~1.5.0",
    "bootstrap": "~3.3.6"
  }
}

What could be the cause?

rvl commented 8 years ago

It's certainly not fast -- and I changed bower2nix to get all dependencies in sequence rather than in parallel because it's more reliable.

But for the example I am getting results more like 15 seconds.

$ time nix-shell -p nodePackages.bower2nix --run "bower2nix dev/bower2nix/example/bower.json"      
{ fetchbower, buildEnv }:
buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
  (fetchbower "angular" "1.5.5" "~1.5.0" "15v5zm6bs4lx5v00vx2mnbd7m8cf1ds523g28yw9vbnjf03bnany")
  (fetchbower "bootstrap" "3.3.6" "~3.3.6" "1id5ip9jjc1gqg4bbc8q3bdxgaf695w0z6w5xddc1w3zcj493pbd")
  (fetchbower "jquery" "2.2.3" "1.9.1 - 2" "034g53l52951j5ybavrjf3ckppn5ddlp3120bf6d4xrx0rqlipim")
]; }
nix-shell -p nodePackages.bower2nix --run   5.62s user 0.62s system 41% cpu 15.111 total

$ time nix-shell -p nodePackages.bower2nix --run "fetch-bower angular"
{"name":"angular","version":"1.5.5","license":"MIT","main":"./angular.js","ignore":[],"dependencies":{},"homepage":"https://github.com/angular/bower-angular","_release":"1.5.5","_resolution":{"type":"version","tag":"v1.5.5","commit":"cd353693d20736baa44fb44f65f8f573ef6e8e18"},"_source":"https://github.com/angular/bower-angular.git","_target":"*"}
  2.15s user 0.17s system 51% cpu 4.510 total
$ time nix-shell -p nodePackages.bower2nix --run "fetch-bower bootstrap"
{"name":"bootstrap","description":"The most popular front-end framework for developing responsive, mobile first projects on the web.","keywords":["css","js","less","mobile-first","responsive","front-end","framework","web"],"homepage":"http://getbootstrap.com","license":"MIT","moduleType":"globals","main":["less/bootstrap.less","dist/js/bootstrap.js"],"ignore":["/.*","_config.yml","CNAME","composer.json","CONTRIBUTING.md","docs","js/tests","test-infra"],"dependencies":{"jquery":"1.9.1 - 2"},"version":"3.3.6","_release":"3.3.6","_resolution":{"type":"version","tag":"v3.3.6","commit":"81df608a40bf0629a1dc08e584849bb1e43e0b7a"},"_source":"https://github.com/twbs/bootstrap.git","_target":"*"}
  1.83s user 0.31s system 32% cpu 6.543 total
$ time nix-shell -p nodePackages.bower2nix --run "fetch-bower jquery"                              
{"name":"jquery","main":"dist/jquery.js","license":"MIT","ignore":["package.json"],"keywords":["jquery","javascript","browser","library"],"homepage":"https://github.com/jquery/jquery-dist","version":"2.2.3","_release":"2.2.3","_resolution":{"type":"version","tag":"2.2.3","commit":"af22a351b2ea5801ffb1695abb3bb34d5bed9198"},"_source":"https://github.com/jquery/jquery-dist.git","_target":"*"}
  1.72s user 0.18s system 53% cpu 3.519 total

The source of the slowness is probably that it downloads the whole frontend package just to get the bower info. I'm open to ideas about how to make it faster.