파일을 메모리에 저장하는 방식으로, 텍스트 파일을 원본 버퍼와 추가 버퍼로 나누어 새로운 내용을 기록함으로써 중간 삽입 시 발생하는 성능 문제를 효과적으로 해결
source: tells us which buffer to read from.
start: tells us which index in that buffer to start reading from.
length: tells us how many characters to read from that buffer.
{ "original": "the quick brown fox\njumped over the lazy dog", "add": "went to the park and\n", "pieces": [ Piece(start=0, length=20, source="original"), Piece(start=0, length=21, source="add"), Piece(start=20, length=24, source="original"), ], }
A blog by Darren Burns
The piece table is the unsung hero data-structure that is responsible for much of the functionality and performance characteristics we’ve come to expect from a text editor. Visual Studio Code has one. Microsoft Word 2.0 had one back in 1984.
https://darrenburns.net/posts/piece-table/

Seonglae Cho