[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Syntax Highlighting



Attached is a simple patch that improves syntax highlighting performance. Opening a large .sc file (6500 lines) previously took about 10 seconds of beach balling, with the patch it opens instantly. It works by changing the text color via textStorage (rather than the text view) and wrapping the entire colorization loop in beginEditing and endEditing calls. Why this improves performance is documented here: http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/ Tasks/BatchEditing.html

I also cleaned up the code a bit.

Ryan

Attachment: syntaxColorize.M.patch
Description: Binary data