Hacker News new | ask | show | jobs
by beached_whale 28 days ago
when serializing these things it's generally going to be best to put the tag first though. That way it's cheap to figure out how to parse it.
1 comments

The serialization format, does not need to be the in-memory representation format.

Unless, you do de-serialization and serialization in tight-loop I guess is it acceptable.

NOTE: A bigger problem is when you need to decide at runtime which one of the kind you have been handled.

It's a perf issue for the stuff I write, it's just faster to deserialize without having to go back in the file. This comes up with tagged types like variant/expected/...