Apex › Storage & databases

Piece table — how a text editor holds your document

The structure VS Code (and historically Word) uses to edit text without ever moving the bytes. The original file is loaded once and never mutated; everything you type is appended to a separate buffer; and the document is just an ordered list of pieces — spans into those two immutable buffers. That's why edits are cheap and undo is nearly free. Insert and delete, and watch the pieces re-stitch while the buffers stay put.

More in Storage & databases