3 ms·
the “(super) efficient” is not there yet. Io is still dynamic dispatch with multiple layers of indirection. afaik it’s slower than before. the upcoming releas
by ulbu 4mo ago
the “(super) efficient” is not there yet. Io is still dynamic dispatch with multiple layers of indirection. afaik it’s slower than before.
the upcoming releases are expected to provide a solution to this “dispatch is comptime-known, but still dynamic” problem, and drop the loses in efficiency.
- rsyring 4mo agoThe parent seems to be talking about efficient code style, not necessarily performance implementation, as they go on to discuss how it looks. That is, I think the point was DevX not io performance.
- bbkane 4mo agoHmm in the 2025 talk ( https://youtu.be/f30PceqQWko?si=qZESxMaSyt7fYMfz https://youtu.be/f30PceqQWko?si=qZESxMaSyt7fYMfz ), Andrew emphasizes that this approach is more efficient than before- even showing compiled assembly iirc. I guess that was a one-off?
- chaz72 4mo agoMy guess is that one of these (Andrew) is measuring syscalls and the other is measuring vtable indirections.
- kristoff_it 4mo agoA vtable indirection is essentially free when you're going to perform a syscall. What matters is that the buffer is above the vtable (which is already the case for the current implementation) so that you don't pay for the indirection when hitting the buffer.
- chaz72 4mo agoApples and oranges, yeah. I should have spelled that out more, thanks.
- rastignack 4mo agoAnd if you write to a bytes buffer?
- nullpoint420 4mo agoWow that’s gnarly it’s using dynamic dispatch. I mean I get it, but I thought zig was some sort of performance demon.
- dnautics 4mo agoif youre doing io, one pointer indirection seems unlikely tp be rate limiting. same for allocation (the other dynamic dispatch in zig)
- lukaslalinsky 4mo agoIt's not just I/O, it's also mutexes, condition variables, time, etc. It's not horrible, but it does add up, so calling it super efficient is a stretch.
- kimixa 4mo agoA modern allocator with per-thread cache can satisfy some allocations in 20-30 cycles - dynamic dispatch can easily double that, even if the target is still in cache. It's one of these things where it's extremely use case dependant - like many performance issues, you probably don't care about it - but when you do it matters.
- delamon 4mo agoInderect call cost is a few cycles, if predicted. Now, you can argue, that it may be mispredicted and misprediction would cost about 20-30 cycles. But if it is mispredicted, then you are not calling into allocator often enough. And if you don't hammer it hard, then why do you care about preformance?
- smj-edison 4mo agoI believe their plan is using "restricted function pointers", where you can specify that a pointer will only ever be to a function defined in the codebase. I'm pretty sure they also have plans for devirtualization, but I haven't followed super closely.
- sieabahlpark 4mo ago[dead]