witheve / Eve

Better tools for thought

Home Page:http://witheve.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editing slows significantly on larger documents

joshuafcole opened this issue · comments

This is almost entirely due to CM.indexFromPos and CM.posFromIndex, calls to which (aggregated from the various places they happen) account for somewhere between half to three quarters of the execution time of a continuous typing profile. It's pretty clear these aren't meant to be on a hot path, but they're currently on basically every editing hot path due to our half-baked projectional span mapping technique. We either need to bite the bullet and do a more proper incremental update of the document or give up on the mapping and find a faster approach to preserving state in a meaningful way. In the interim, caching values until the document is dirtied would probably help, but it's likely not worth the trouble vs just going all in on one of the proper fixes.

For reference, this was issue was noticed when working with the following Eve program: https://github.com/witheve/mamarob/blob/54b79c57bdf8294d4ace3004e9227f8445167325/food-truck.eve.md

Mitigated somewhat by #731