Если вы ещё вдруг не знаете — на прошлой неделе MS открыли спецификации своих бинарных форматов. Да-да, те самые doc, xls и ppt. Joel Spolsky написал о том, что из себя представляют эти форматы:
If you started reading these documents with the hope of spending a weekend writing some spiffy code [...], the complexity and length of the spec probably cured you of that desire pretty darn quickly. A normal programmer would conclude that Office’s binary file formats:
- are deliberately obfuscated
- are the product of a demented Borg mind
- were created by insanely bad programmers
- and are impossible to read or create correctly.
Неудивительно, что разработчики KOffice говорят, что у нас мол тут никому не интересно реализовать поддержку форматов MS, дайте с ODF сначала разобраться.
Но речь не о том. Дальше в статье объясняется, почему эти спецификации такие сложные и запутанные. И на самом деле первая причина тут самая главная — без неё все остальные бы легко было отмести:
They were designed to be fast on very old computers. For the early versions of Excel for Windows, 1 MB of RAM was a reasonable amount of memory, and an 80386 at 20 MHz had to be able to run Excel comfortably. There are a lot of optimizations in the file formats that are intended to make opening and saving files much faster
These are binary formats, so loading a record is usually a matter of just copying (blitting) a range of bytes from disk to memory, where you end up with a C data structure you can use. There’s no lexing or parsing involved in loading a file. Lexing and parsing are orders of magnitude slower than blitting
К чему это я? До всё к тому же, последний абзац нас возвращает к предыдущей заметке о намерениях Google перевести GTalk на бинарный протокол. Google собирается продвигать свой IM на мобильные платформы, на которых процессорные ресурсы ограничены. Ну а XMPP они использовали, потому что изначально это облегчало разработку и помогло привлечь гиков.
Нет комментариев »
Еще нет комментариев.
RSS feed for comments on this post. TrackBack URL
Оставить комментарий:


Комментарии