I would like to understand the internal architecture and strategy used by org-mode.
how does org-mode avoid re-parsing the document after every change?
For example, let's say I have a 2 meg org-mode file/buffer.
There is a TODO in the middle of the file.
I accidentally put a space in the middle of "TODO", so it becomes "TO DO".
After that insert, org-mode needs to remove that TODO (and possibly its children) from its internal data structures. However, from what I can tell, org wouldn't know what the change was. It would have to reparse the whole buffer and then compare the old tree with the new tree. Any agenda views would also have to update after this single keystroke.
How does org-avoid having to perform such an expensive computation for every key stroke?