help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: State-machine based syntax highlighting


From: Robert Thorpe
Subject: Re: State-machine based syntax highlighting
Date: 7 Dec 2006 10:57:18 -0800
User-agent: G2/1.0

spamfilteraccount@gmail.com wrote:
> Stefan Monnier wrote:
> >
> > Actually, font-locking *is* implemented in C.  The elisp part usually takes
> > a negligible amount of time.  The problem start appearing when the
> > functionality of the C code is not sufficient and you start trying to parse
> > the code in elisp, which is slow.
>
> Good to know. I thought font-lock was implemented in elisp and didn't
> bother to check.

Precisely speaking...
The code that determines what rules are used to font-lock text is in
Elisp.
The regexp engine that finds the things to be font-locked is in the
core of Emacs.
The colourisation is implemented in the Emacs core.

Overall this means that most of the work is in the Emacs core.

If parsing were to be used to support syntax highlighting then maybe
some work would have to be done to avoid having to use Elisp.  But I'm
not sure since it would still require loads of regexps and they would
probably still eat up a lot of the runtime.

> BTW, I checked the situation in the enemy camp and seems they also have
> problems with performance:

Almost every editor does with both large files and syntactically
complex languages.  As far as I know, Emacs is a little slower than Vim
at least in some cases.

If you want to avoid the problem then use <4000 line files and write
your programs in Lisp.  Those are good things to do anyway ;)



reply via email to

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