Re:Rust and Nix = easier Unix systems programming
by cmrdporcupine on Thursday April 14, 2016 @01:14PM
(#11498565)
Meanwhile this extra memory usage _might_ be relevant on an 8k microcontroller, but even that is questionable given such an application is likely not storing many strings. And the time (and battery! and sanity!) saved by not performing strlen type operations.
Worth every byte.
The only time the size-prefixed variant doesn't require more memory is when the string length is a multiple of 4. So the length-prefixed version requires an additional 3 bytes on average.