|
> Maybe I misunderstand, but I'm not sure I see the point about hard working engineers or memory mapping I was just saying, in my experience, binary formats tend to be easier to parse than text, relying on machine native constructs such as binary integers, sometimes even matching up their stored formats to C struct layouts (this is the case with, Linux's inode format for example). Whereas complex textual formats such as JSON or Javascript usually have a tokenization and parsing pass. But they are mostly human readable in exchange, which is a ton more engineering effort to build and CPU time to run. I was just trying trying to say, that once you really get into sophisticated binary formats, you have to take on similar levels of complexity to parsing something like a programming language, meaning that the parser is not simple, or fast, but the file is not human readable either. Which is kinda the worst of both worlds, and doesn't really drastically reduce file size. TLDR: Text-based formats are fine, expecially for complex data, and are surprisingly competitive with hand-tuned binary formats. |
I've written a lot of text parsers for pet programming languages and other things, and several binary parsers for work related stuff. I agree that bad binary formats are really awful. I don't remember the details now, but I gave up on trying to deal with Matlab data files.
WASM made it pretty easy to parse though. Kind of like TIFF or WAV files, the section type and length is right there when you need it even if you're streaming, and it's easy to skip sections you don't know or care about. There's a little bit of error-prone grossness having both unsigned and signed LEB128 inside of some sections though.