logoalt Hacker News

socalgal2yesterday at 6:01 PM1 replyview on HN

Those practices make things hard to modify and update. As one example, I use to use binary formats for game data. The data is loaded into memory and it's ready to use, at most a few offsets need to be changed to pointers, in place.

Good: (*) no extra memory needed (*) can read directly from CD/DVD/HD to memory - not through buffered i/o (*) no parsing time

Bad: (*) change or add a single field in to any part of the saved data and all previous files are now invalid.

I'd solve this with a version number and basically print a message "old version in file, rebuild your data"

Modern apps use JSON/Protobufs, etc. They are way slower to load, take way more memory as there are usually 2 versions of the data, the data in the file and the parsed data your app is actually using. They take time to parse.

But, they continue to work even with changes and they can more trivially be used across languages and apps.

That's just one example of 100s of others where the abstraction is slower and uses more memory but provides flexibility the old ones didn't.


Replies

pjmlpyesterday at 6:34 PM

No need for such extremes, it would already be enough to stop using Electron crap, or React on the terminal.

Followed by actually reading a data structures and algorithms book.

Finally, using compiled languages instead of interpreted ones.

No need to count bytes to fit into 48 KB.

show 1 reply