Post AVup2kIScYRGLmDKoS by matthewcroughan@social.defenestrate.it
 (DIR) More posts by matthewcroughan@social.defenestrate.it
 (DIR) Post #AVup2kIScYRGLmDKoS by matthewcroughan@social.defenestrate.it
       2023-05-22T11:54:16.118794Z
       
       0 likes, 0 repeats
       
       Ouch... now that's what I call #tvix#nix #nixoshttps://nlnet.nl/project/Tvix/
       
 (DIR) Post #AVup2lzOKQNDbDJ8Mq by Ninjatrappeur@social.alternativebit.fr
       2023-05-22T14:13:19.843636Z
       
       0 likes, 0 repeats
       
       @matthewcroughan Press x to doubt. You're comparing a non flake eval with a flake eval.Without Nix Flakes, Tvix is about 10x slower:
       
 (DIR) Post #AVuzvXyB9ZcfaSUtlo by flokli@im-in.space
       2023-05-22T13:56:18Z
       
       1 likes, 0 repeats
       
       @matthewcroughan as much as I appreciate the good vibes, there's still some hash differences we want to sort out. The goal is to evaluate the same, and your test doesn't check for this 😉 Also, what tvix commit did you run this with? We didn't put too much effort into performance tuning, as the current version still shells out to `nix-store` for some low-level store interactions (which should be slower than what the screenshot suggests).(There's a CL up for review using our own codepaths for this)
       
 (DIR) Post #AVvGS1bi5yvy2WUqG0 by matthewcroughan@social.defenestrate.it
       2023-05-22T18:43:18.910914Z
       
       1 likes, 0 repeats
       
       That's not flake eval. There is no flakes. I get the same results on Nix 2.3. Although it leads to an infinite recursion on Nix whereas on Tvix not. Not sure about this test I've done now.
       
 (DIR) Post #AVvH6Y3uqe5AHR0pyS by Ninjatrappeur@social.alternativebit.fr
       2023-05-22T19:27:50.724002Z
       
       0 likes, 0 repeats
       
       @matthewcroughan My bad. I thought that nix eval was initializing the flake registry by default, hence the slowdown.I was wrong. That being said, it’s not doing a “regular” evaluation either.nix eval is recursing in the resulting attrset until it ends up encountering a string: https://github.com/NixOS/nix/blob/86e724366ccab1ffa5945f7cdafa1a2448853183/src/nix/eval.cc#L97 .In terms of eval semantics, you’re roughly doing a builtins.deepSeq ((...) numpy) here. It explains the slowdown.If you’re “just” trying to evaluate up to the derivation boundary, like Tvix does (rightfully so), you’re looking for nix-instantiate. And then, you’ll get the 10x slowdown. Which again, should be greatly reduced when they start integrating tvix-store to the project.
       
 (DIR) Post #AVwPntXfr6588u4VZg by matthewcroughan@social.defenestrate.it
       2023-05-22T20:34:49.781475Z
       
       1 likes, 0 repeats
       
       Ah! That makes a lot of sense now that you've explained it. I'm glad to be wrong, hopefully this gets some interest in tvix nonetheless.