3 ms·
Yes, 0-alloc and minimal copying is a key constraint here. :-) If you take that away, then there's no real problem here.
by burntsushi 3y ago
Yes, 0-alloc and minimal copying is a key constraint here. :-) If you take that away, then there's no real problem here.
- masklinn 3y agoI could easily imagine trying to do it because I can rather than because I actually need to. Also because of the missing middle: in Go (or Java, or C#, or even python) you could hand out slices to a large buffer, but discard the buffer rather than refill it in place, relying on the GC to clean things up (and possibly give you the same buffer on the next allocation). So you get an efficiency middle ground where you allocate more than strictly necessary but not for every line, and maintain correctness. In Rust that’d require some sort of Rc projection which I’m not sure even exists?