| ▲ | foobiekr 3 days ago | ||||||||||||||||||||||
Two big issues in Golang are that you can't actually build an arena allocator that can be used for multiple types in a natural way. The other is that almost no library is written in such a way that buffer re-use is possible (looking at you, typical kafka clients that throw off a buffer of garbage per message and protobuf). The latter could be fixed if people paid more attention to returning buffers to the caller. | |||||||||||||||||||||||
| ▲ | bilbo-b-baggins 3 days ago | parent | next [-] | ||||||||||||||||||||||
You totally can build it using unsafe and generics. I’ve done it with mmap-backed byte slices for arbitrary object storage. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | fpoling 3 days ago | parent | prev [-] | ||||||||||||||||||||||
Rust also suffers from libraries returning a newly allocated strings and vectors when the code should allow to pass a pre-existing string or vector to place the results. Granted the latter leads to more verbose code and chaining of several calls is no longer possible. But I am puzzled that even performance-oriented libraries both in Go and Rust still prefer to allocate the results themselves. | |||||||||||||||||||||||