!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1922 Members
Nix programming language357 Servers

Load older messages


SenderMessageTime
19 May 2026
@amadaluzia:4d2.orgamadaluzia changed their profile picture.20:58:44
20 May 2026
@me:nahsi.devnahsi joined the room.09:09:48
@me:nahsi.devnahsi left the room.09:41:01
@me:nahsi.devnahsi joined the room.09:48:48
@lumi:the-apothecary.clubNuwa changed their profile picture.21:00:54
@lumi:the-apothecary.clubNuwa changed their display name from Hazel to Aspen.22:37:52
21 May 2026
@libregeekingkid:matrix.orgrajudev joined the room.00:00:20
@moatx:matrix.org@moatx:matrix.org removed their profile picture.15:47:26
@k.sommer:mozilla.org@k.sommer:mozilla.org joined the room.16:29:06
@k.sommer:mozilla.org@k.sommer:mozilla.org changed their display name from k-sommer to k-sommer 🏳️‍⚧️.16:29:51
@k.sommer:mozilla.org@k.sommer:mozilla.org changed their display name from k-sommer 🏳️‍⚧️ to 🏳️‍⚧️❄️ k-sommer (she/her).16:42:18
@bonsal2:matrix.orgjayf99 joined the room.18:45:33
@k.sommer:mozilla.org@k.sommer:mozilla.org left the room.20:48:28
@moatx:matrix.org@moatx:matrix.org left the room.22:01:44
22 May 2026
@lin_0kx:catgirl.cloud凛锋 changed their profile picture.10:24:09
@share-x:matrix.orgshare-x joined the room.15:22:09
23 May 2026
@exodus786:matrix.orgdj joined the room.06:04:20
@inclyc:matrix.orgYingchi Long changed their profile picture.11:24:37
@mtmn:matrix.orgmtmn joined the room.15:20:49
25 May 2026
@llakala:matrix.orgllakala

how does nix handle these differently when it comes to laziness?

let
  inherit (builtins) isInt genList;
  assertMsg = pred: msg: pred || throw msg;
  v1 =
    x:
    assert isInt x || throw "error message";
    x * 2;
  v2 =
    x:
    assert assertMsg (isInt x) "error message";
    x * 2;
  indices = genList (i: i) 100;
in
map v2 indices

i understand that assertMsg and similar functions (throwIf, warnIf, etc) are bad for performance - i can run stats on both versions and tell you that we go from 7 -> 107 thunks, 200 -> 400 function calls, and 4300 -> 7500 envs.bytes when using v2. what i don't get is how we're able to only have 7 thunks in the || case. how do we not need to create a thunk on every call?

01:58:00
@llakala:matrix.orgllakala (posted this in #users:nixos.org and was sent here for esoterica) 01:58:17
@infinisil:matrix.orginfinisilA while ago i wrote https://wiki.nixos.org/wiki/Nix_Evaluation_Performance which should help here :)07:25:51
@llakala:matrix.orgllakalayes I've read that - but that doesn't clarify how || works11:04:19
@llakala:matrix.orgllakala(off-topic but I'd appreciate a response on https://github.com/NixOS/nixpkgs/pull/520174)11:06:16
@lumi:the-apothecary.clubNuwa changed their profile picture.11:25:50
@lumi:the-apothecary.clubNuwa changed their profile picture.11:27:04
@lumi:the-apothecary.clubNuwa changed their display name from Aspen to Orion.11:27:52
@lisa:bylisa.devlisa changed their profile picture.11:37:25
@funzen:matrix.orgfunzen set a profile picture.12:39:32
@piegames:flausch.socialpiegamesCould it be that function applications are not counted as thunks? I'm not sure I would trust the code to accurately track all counters at all times, the stats code is badly designed (slapped on) and thus notoriously badly maintained16:25:18

Show newer messages


Back to Room ListRoom Version: 6