[TxMt] Performance issues

Allan Odgaard throw-away-1 at macromates.com
Sat May 27 21:29:17 UTC 2006

On 27/5/2006, at 16:03, Aristide Grange wrote:

> Thank you for having explained me how to solve this stupid-but-big  
> problem with search/replace in TextMate! [...]

Just FYI the problem comes not from stupid code but from data  
structure trade-offs.

TextWrangler, which you mention, use (AFAIK) a continuous buffer for  
the text with a gap/hole where the caret is. This allows for constant  
time movement and insertion, and linear time search’n’replace --  
generally a very good data structure for a text editor, except it  
does not (easily) allow for many of the things I do in TextMate, for  
example folding of code blocks.

I instead use a data structure which does most normal editing  
operations just fine, and allows for easy attaching meta data to  
text, preserving meta data after editing operations, etc. --  
something which has proven very valuable through the last year, used  
e.g. for smart typing, real time snippet transformations, etc.  But  
it has trade-offs, like doing a global replacement involving \n.

So this is not about fixing broken code, it is about coming up with  
data structures that gives you the best of everything.

More information about the textmate mailing list