| I guess I'm just not understanding the minimum subtraction example. They claim it only loops through the array once, and I see that in the code, but I don't see how that's possible. In Python land I can certainly do [x - min(v) for x in v] and maybe that looks like I'm only going once but really I'm not. Maybe I'll fire up the compiler and check the resulting code. I guess I'm still in the edit window. I installed it. Naturally once of its hundreds of dependencies needed a newer rustc than the 22.04 PPA but whatever, got that sorted. Turns out it doesn't compile down into assembly but if I'd kept reading I would've seen that it goes to Ivy, an intermediate language that's run later. Running the example gives: > vine run vine/examples/sub_min.vi
[1, 0, 4, 6] Interactions
Total 948
Annihilate 491
Commute 21
Copy 88
Erase 102
Expand 142
Call 63
Branch 41 Memory
Heap 1_184 B
Allocated 19_520 B
Freed 19_520 B Performance
Time 0 ms
Speed 6_245_059 IPS Apparently the stats are default. Which makes this feel like a toy but again, whatever. Running that first way gives: Interactions
Total 1_069
Annihilate 562
Commute 21
Copy 96
Erase 114
Expand 163
Call 67
Branch 46 Memory
Heap 1_184 B
Allocated 22_000 B
Freed 22_000 B Performance
Time 0 ms
Speed 7_088_859 IPS IPS seems quite variable at this small an input size. So my conclusion is: if it helps one write code better, go for it. Who cares. But this certainly doesn't seem like some magic bullet that doesn't need to go through the array twice. The ivy code is not very human friendly so I couldn't wrap my head around what it's actually doing, but it looks like it's a bunch of functional programming. It really does look quite slow and mathematically pure. So as a math toy I think it's doing a good job. |