[TxMt] Slow writing and FruitMenu

Allan Odgaard throw-away-1 at macromates.com
Fri Nov 3 23:12:37 UTC 2006


On 3. Nov 2006, at 21:12, Alaric Snell-Pym wrote:

> [...]
> Since it depends on the scroll position, I presume this problem is
> with the display code, but it could be an inefficiency in the
> underlying text buffer data structure that the display code brings to
> light? I dunno.

There are at least 3 things which can significantly affect typing speed:

  1) text rendering -- this is *horrible* slow for long lines, the  
black box structure of the APIs I am using makes it difficult to ask  
for rendering just a subset of the line, but I am placing good money  
on CoreText for Leopard. A test for this problem is to enable soft wrap.

  2) spell checking -- the system spell checker can be very slow with  
misspelled words, and I pass the full line to the spell checker each  
time the line changes. A test for this is to disable spelling as you  
type: I think part of the problem is that if there is a misspelled  
word, the spelling server then checks all dictionaries for that word,  
so misspelled words result in much worse performance out of the spell  
checker than correctly spelled words

  3) folding patterns -- when you edit a line, it is checked against  
the folding patterns for the current language grammar. These are  
regular expressions, and if crafted in an unfortunate way, they can  
have exponential time complexity. We have fixed a few of such cases,  
mostly it can be fixed by just changing the pattern.

     Of course there could also be a problem with the actual language  
grammar parser, as this one is also based o regular expressions.

To test the latter thing, change the language (but as that can change  
preferences for #1 and #2, check those first).








More information about the textmate mailing list