| 21 Nov 2025 |
mzero | did the special casing for small lists get removed? there are still comments that refer to it, but I'm not seeing it in the code (though I could just be missing it) | 20:54:15 |
raitobezarius | removed, indeed | 20:54:40 |
raitobezarius | did you notice something problematic for small lists? | 20:54:48 |
mzero | no, I was just looking at the string changes in the release notes and noticed it. is there any perforce impact from it? I assume lists with exactly 2 elems aren't that common, but I'm still curious. | 20:59:59 |
raitobezarius | AFAIK, this optimization is noise when we looked | 21:07:47 |
raitobezarius | Lists with 2 elems are usually pairs in Nixlang | 21:07:58 |
raitobezarius | Unnamed pairs | 21:08:07 |
Sergei Zimmerman (xokdvium) | I did research a bit the distribution of list sizes when evaling nixpkgs. Small lists are quite often used, but lists just pale in comparison with attrsets overall | 21:17:12 |
mzero | name value pairs are so common because of listToAttrs, etc, I wonder if a pair type would actually make a significant perf difference | 21:19:00 |
Sergei Zimmerman (xokdvium) | A more generic approach could be to have "attrset shapes". Very similar to how v8 optimizes classes with the same layout | 21:20:09 |
Sergei Zimmerman (xokdvium) | Then names wouldn't need to be stored in the attribute set and function calls could reuse the same memory and not copy anything to a new Env.
(I and Robert Hensing discussed this a bit at some point) | 21:21:57 |
Qyriad | In reply to @xokdvium:matrix.org A more generic approach could be to have "attrset shapes". Very similar to how v8 optimizes classes with the same layout benefits of a JIT especially | 21:22:04 |
Sergei Zimmerman (xokdvium) | Not exactly tho. jit/memory layout are tangential somewhat | 21:22:32 |
Qyriad | yeah but you can optimize hot shapes | 21:22:56 |
Sergei Zimmerman (xokdvium) | Yeah. I think python has slots for this kind of thing | 21:23:13 |
Sergei Zimmerman (xokdvium) | * Yeah. I think python has __slots__ for this kind of thing | 21:23:28 |
mzero | do you have something I could read about that? I'm curious how it would work. | 21:25:02 |