| ▲ | woodruffw 3 hours ago | ||||||||||||||||
> Given that "zero-copy" apparently means "in-memory" (a deserialized version of the data necessarily cannot be the same object as the original data), that's not even difficult to do with the Python standard library This is not what zero-copy means. Here's a working definition[1]. Specifically, it's not just about keeping things in memory; copying in memory is normal. The goal is to not make copies (or more precisely, what Rust would call "clones"), but to instead convey the original representation/views of that representation through the program's lifecycle where feasible. > a deserialized version of the data necessarily cannot be the same object as the original data rust-asn1 would be an example of a Rust library that doesn't make any copies of data unless you explicitly ask it to. When you load e.g. a Utf8String[2] in rust-asn1, you get a view into the original input buffer, not an intermediate owning object created from that buffer. > (That does, of course, copy data around within memory, but.) Yes, that's what makes it not zero-copy. [1]: https://rkyv.org/zero-copy-deserialization.html [2]: https://docs.rs/asn1/latest/asn1/struct.Utf8String.html | |||||||||||||||||
| ▲ | zahlman 3 hours ago | parent [-] | ||||||||||||||||
> Yes, that's what makes it not zero-copy. Yeah, so you'd have to pass around the `BytesIO` instead. I know that zero-copy doesn't ordinarily mean what I described, but that seemed to be how TFA was using it, based on the logic in the rest of the sentence. | |||||||||||||||||
| |||||||||||||||||