beaver-devel
[Top][All Lists]
Advanced

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

[Beaver-devel] The future of syntax highlighting


From: Michael Terry
Subject: [Beaver-devel] The future of syntax highlighting
Date: Tue, 11 Mar 2003 15:47:52 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030224

Hello again, Leslie.

I wanted to open a dialog about possible futures of syntax highlighting (syhi). The current system, as I mentioned in a previous email, is broken up into two algorithms. One is designed for speed, the other for correctness.

Each, though, basically goes through the text, looking for delimiters and looks up stuff between delimiters in a hash table of keywords.

Now, this algorithm seems simple enough to me, and I can't think of a fundamentally different way to do it. Yet, it doesn't seem fast enough. It's fine for small files or just highlighting as you type, but when one opens a large file, Beaver can take a bit to highlight it.

The way I solved this was to update the GUI as we highlight, if we take over half a second to highlight. This slows down total highlight time, but increases perceived responsiveness. This solution seems to work ok.

However, it might be worthwhile to acquire a better solution. For example, we were talking about Scintilla. SciTE, based on Scintilla, does a tremendously fast job of highlighting (at least, I've never noticed the highlighting, which is arguably our goal -- that the user never notices it; it just happens). I've spent a moment looking at the code, and it has specific highlight engines for different languages. This might be a consideration for us.

I'm not sure if we want to actually use Scintilla ourselves, since it is written in C++, seems tied to GtkTextisms (rather than GtkTextViewisms), and uses a different signaling model than GTK+.

I'm not sure what we could do differently with a language-specific parser though. We would still have to go through and look for delimiters. We would still have to look up keywords in some data structure (a hash table still seems optimal). The wordfile system we use now is just a generic way of describing a language. I don't think we are losing speed because of this genericness.

Do you have any ideas on amazing syhi algorithms or ways to outsource the issue? How do you feel about the current syhi speed?

-mt

Attachment: pgpTTU5GXesx2.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]