News for hackers. Stuff that matters.
Re:Fast memcpy, A System Design by titzer on Monday December 19, 2022 @09:15PM (#34060711)
A lot of the additional data movement is a.) defensive copies because too many data structures are mutable and b.) change of data format to internal software representations, e.g. wire->decode->IR1->...->IR1->encode->wire.
Re:Fast memcpy, A System Design by robotresearcher on Monday December 19, 2022 @09:35PM (#34060838)
> change of data format to internal software representations

There is so much of this. Is there any hope for a world where we can ship working memory without costly XDR? Does anyone have data on the rate of change of time or energy spent on XDR translation?

Re:Fast memcpy, A System Design by titzer on Monday December 19, 2022 @09:46PM (#34060915)
I have thought a lot about this over the years, and I think one of the issues is that it is hard to specify fixed data formats in most programming languages (in a declarative way), leading to lots of code that decodes byte-by-byte or word-by-word. Since writing all that sucks, many programmers have turned to higher-level data formats such as JSON or protobufs that are decoded by libraries.

I have been working on a new feature in Virgil to make writing explicit byte-by-byte layouts easier and directly supported by the compiler. It's still a work in progress though.

Re:Fast memcpy, A System Design by nerpderp82 on Monday December 19, 2022 @10:03PM (#34061021)
If the heap were treated like a typed database, with transaction semantics, many of our problems with disappear. Layout should not be an implementation detail. I know Wasm won't solve this explicitly, but at least have a chance while everything is being redefined.
Re:Fast memcpy, A System Design by robotresearcher on Monday December 19, 2022 @10:33PM (#34061210)
Wouldn’t that move the data transformation costs from at I/O time to all the time?
Re:Fast memcpy, A System Design by monocasa on Tuesday December 20, 2022 @02:20AM (#34062686)
Not if the encoding can simply be consumed in place, needing only a validation pass if it's coming from an untrusted source. Cap'n Proto is pretty close to that for one example.
Re:Fast memcpy, A System Design by NavinF on Tuesday December 20, 2022 @04:25AM (#34063582)
> a world where we can ship working memory

Yes, you can have zero serialization latency: https://capnproto.org/