ElvishJerricco / nix-purescriptPackages

19 stars 0 forks source link

8 gigs mem + 8 cores saturated #2

Closed sjmackenzie closed 7 years ago

sjmackenzie commented 7 years ago

Very hopeful project, keep this ball rolling!

After git cloning on nixos and running nix-build My system locks up, completely non-responsive, all 8 cores nearly hit 100% and all of my 8 gigs of memory is used.

ElvishJerricco commented 7 years ago

I have also noticed some obscure performance with this system, though nothing nearly that bad. I haven't really tried to debug it, so I honestly have no idea what the problem is. I don't think it's psc, since that seems to perform fine elsewhere usually.

sjmackenzie commented 7 years ago

Oh interesting, firstly, let me understand how you invoke the system, so that I can incrementally understand this problem.

Do you just nix-build the system? Or nix-build -A xxx?

I have a relatively beefy machine so I'm quite surprised to see it completely lockup. Also it doesn't die immediately, I get to the point of calling like 4~6 (forgot) psc instances then after about a minute everything locks up.

ElvishJerricco commented 7 years ago

I just do nix-build. It should call psc once for each package. More than that is unexpected.

sjmackenzie commented 7 years ago

okay I've managed to cut back everything ensuring there's enough memory so it doesn't fall over.

I'll do a time nix-build and post the results in a bit.

sjmackenzie commented 7 years ago

Ah I \<ctrl-c>'ed it

$ time nix-build
these derivations will be built:
  /nix/store/93gg6lrd0a4gyq1bxh1yq1r7bzyj93qn-purescript-prelude-2.1.0.drv
  /nix/store/dfp2a7v28mkmsaw4rzfwyk8pqvkv0m54-purescript-eff-2.0.0.drv
  /nix/store/qii8g746kprz13d5yj96aiqkp8v3hn12-purescript-console-2.0.0.drv
  /nix/store/a3icr8ss8wzfxsb5x20plbr0f80c7jj1-purescript-mine-0.1.0.drv
building path(s) ‘/nix/store/qb1h7s7wbs3sp1y38gfx9bm0idnsk2y9-purescript-prelude-2.1.0’
building
^Cerror: interrupted by the user

real    39m44.252s
user    0m0.656s
sys     0m0.071s

Something is very wrong here, I'm very surprised you didn't get a similar actual behaviour.

I'm going to try fiddle with different versions of psc to see what happens.

sjmackenzie commented 7 years ago

Well it definitely seems to be psc falling over. echos before and after reveal it to be the case.

sjmackenzie commented 7 years ago

But other than this, I really appreciate the beautiful nix code. Nice job!

sjmackenzie commented 7 years ago

Would you mind doing a time nix-build on your system please?

sjmackenzie commented 7 years ago

So I let the thing go over night, here's the details:

$ time nix-build
these derivations will be built:
  /nix/store/vvn7plxp6bsz4n5zqq5w1zb86q85z81g-purescript-prelude-v2.1.0.drv
  /nix/store/xwqdqcirwd9fmgrs7l1x7w1ssx39p6af-purescript-eff-v2.0.0.drv
  /nix/store/zlqj6caqyz6ididvhc24xkzx1i18f59c-purescript-console-v2.0.0.drv
  /nix/store/s6ww8c1zwxmyxsn9k1bzxj0r0va0ris7-purescript-mine-0.1.0.drv
building path(s) ‘/nix/store/l8f35irz9lcqb7psni1an5dp82s64nnl-purescript-prelude-v2.1.0’
building
Compiling Data.NaturalTransformation
Compiling Control.Semigroupoid
Compiling Data.Boolean
Compiling Data.Show
Compiling Control.Category
Compiling Data.Void
Compiling Data.Unit
Compiling Data.Function
Compiling Data.Semiring
Compiling Data.HeytingAlgebra
Compiling Data.Eq
Compiling Data.Semigroup
Compiling Data.Functor
Compiling Data.Ring
Compiling Data.Ordering
Compiling Data.BooleanAlgebra
Compiling Data.Ord.Unsafe
Compiling Data.CommutativeRing
Compiling Control.Apply
Compiling Data.Ord
Compiling Data.EuclideanRing
Compiling Data.Field
Compiling Control.Applicative
Compiling Control.Bind
Compiling Data.Bounded
Compiling Control.Monad
Compiling Prelude
installing
building path(s) ‘/nix/store/raxhy0vwsxvgcs6pd5xs2grfh8g7mprs-purescript-eff-v2.0.0’
building
^[^[Compiling Control.Monad.Eff
Compiling Control.Monad.Eff.Class
Compiling Control.Monad.Eff.Unsafe
installing
building path(s) ‘/nix/store/kmbi21zkswjzirqciasiaqrsac1zx4ns-purescript-console-v2.0.0’
building
^[Compiling Control.Monad.Eff.Console
installing
building path(s) ‘/nix/store/4mp9m1vhrw190dfn3fj5pc5khlr3gg9w-purescript-mine-0.1.0’
building
Compiling Main
installing
/nix/store/4mp9m1vhrw190dfn3fj5pc5khlr3gg9w-purescript-mine-0.1.0

real    265m53.532s
user    0m0.747s
sys     0m0.100s

Note I ran your purescript2nix haskell application before hand.

sjmackenzie commented 7 years ago

I've pinged upstream about this: https://github.com/purescript/purescript/issues/2598

ElvishJerricco commented 7 years ago

As determined in that other thread, this appears to be specific to your environment. Anyone should feel free to reopen this issue should this prove to be a problem with purescript-modules in some way.

Also, FYI, I'm likely to move this repository to that name: purescript-modules, or something like that.

sjmackenzie commented 7 years ago

Yes good!

Might I suggest creating an organization to host purescript-modules? I suspect this could easily become the defacto language level package manager for purescript, should it be well maintained, that is!

Again, thank you kindly for your assistance.

ElvishJerricco commented 7 years ago

I actually think this should land in nixpkgs eventually. Basically, as soon as the precompiling issue with psc is resolved, I'll start thinking about making that happen.

ElvishJerricco commented 7 years ago

I would like to see this become the defacto dependency manager for PureScript, but I don't think that will happen because Nix doesn't work on Windows, and it would require a fairly featureful and friendly front end interface so that people don't have to learn the bohemeth that is Nix.

sjmackenzie commented 7 years ago
ElvishJerricco commented 7 years ago

Yea, nixpkgs may be too slow. It certainly wouldn't be hard to have an independent release series, like lts in Stack.

npm is not an example of a nice front end =P All I meant was that requiring users to install Nix and write Nix expressions to use PureScript sounds like a problem. If we could have a decent command line tool to hide these things for those who don't want them, that'd be good, as long as it allows people to drop into Nix directly whenever they want. Without that, I'm afraid this stuff will only be useful to the Nix enthusiasts.

sjmackenzie commented 7 years ago

Probably but you can get away with a lot, say for example, you strip down the requirements for a project to a single configuration file that looks something like this:

{ psmod, psmods, npms }:

psmod {
  src = ./.;
  psmods = with psmods; [ purescript_halogen ];
  npms = with npms; [ leftpad ];
}

The above default.nix will replace every configuration file.

That's no more intimidating than any other config file. Quite possibly there is plenty of millage there!

(Inspiration is derived from a project I contribute to )

ElvishJerricco commented 7 years ago

It has been renamed

sjmackenzie commented 7 years ago

Interestingly enough when bumping this: https://github.com/ElvishJerricco/nix-purescriptPackages/blob/master/nixpkgs/github.json#L4 to this: https://github.com/NixOS/nixpkgs-channels/commit/20eac78ccbc1f8896da75c3596ce23fe649dd46d

I get this:

real    0m16.894s
user    0m26.151s
sys     0m25.387s
installing
building path(s) ‘/nix/store/hrka4b8bflwk90gxclvbbxvibrrgi1mz-purescript-eff-v2.0.0’
building
Compiling Control.Monad.Eff
Compiling Control.Monad.Eff.Class
Compiling Control.Monad.Eff.Unsafe

real    0m21.484s
user    0m41.461s
sys     0m41.964s
installing
building path(s) ‘/nix/store/k3927p99gxw9dscyylmq8sdiqb7fnr3x-purescript-console-v2.0.0’
building
Compiling Control.Monad.Eff.Console

real    0m32.422s
user    1m2.498s
sys     1m5.681s
installing
building path(s) ‘/nix/store/aax2jn23k1x8i0gdsxlplaqip94sfbk9-purescript-mine-0.1.0’
building
Compiling Main

real    1m21.095s
user    2m11.800s
sys     1m38.463s
installing
/nix/store/aax2jn23k1x8i0gdsxlplaqip94sfbk9-purescript-mine-0.1.0