logoalt Hacker News

Const-metoday at 12:33 PM1 replyview on HN

It’s technically possible to do, just very complicated and hard. Quite often, prohibitively so.

Still, the main idea is despite the input files are arbitrarily large, you don’t need an entire file in memory because displays aren’t remotely large enough to render a megabyte of text. Technically, you can only load a visible portion of the input file, and stream from/to disk when user scrolls. Furthermore, if you own the file format, you can design it in a way which allowing editing without overwriting the entire file: mark deleted portions without moving subsequent content, write inserts to the end of files, maybe organize the file as a B+ tree, etc.

That’s how software like Word 97 supported editing of documents much larger than available memory. As you can imagine, the complexity of such file format, and the software handling them, was overwhelming. Which is why software developers stopped doing things like that as soon as computers gained enough memory to keep entire documents, and instead serialize them into sane formats like zipped XMLs in case of modern MS office.


Replies

erutoday at 12:53 PM

What if you don't know ahead of time how big that monitor is that you are displaying stuff on?

In any case, what you are describing sounds like an ad-hoc re-implementation of virtual memory?

show 1 reply