Hacker News new | ask | show | jobs
by joachimma 245 days ago
I wonder why round-trip is such a small concern for people implementing serializers/deserializers of various kinds. I usually throw in an "Unknown" node type, which stores things unaltered until I can understand things again. The parsers I usually write are very small, so I haven't seen what issues comes up at scale, maybe there are dragons lurking .
1 comments

This is the solution for that particular issue that Tritium uses.

[NOTE: one dragon would be the memory consumption alluded to in the article.]

Could you intern strings? Seems like you're likely to see the same tags and attributes over and over.
Yes, and there are probably a lot of other clever ideas. But the better solution is probably just to implement more of the spec. Once you get through maybe 80% of the tags, you've eliminated 99.9% of the memory issue given their frequency distribution.