On 08 Feb 2002 at 01:44:37 +0900, "Stephen J. Turnbull"
<stephen(a)xemacs.org> wrote:
Remember all we're doing here is to _indent one line_. In the
case of
the TAB (which causes twice as many scans!!), font-lock should not
change anything---if it does there's a bug! Arguably font-lock (less
likely, cc-mode) is broken. In languages where indentation is not
syntactically significant, there is no good reason for changes in
indentation to cause XEmacs to go charging up and down the buffer
scanning sexps.
Here's one more datapoint for you. I'm using PVS
(<
URL:http://pvs.csl.sri.com/>). Loading its prelude.pvs file, font
locked, used to be nearly instantaneous under XEmacs 21.1. With 21.4,
it takes about 8 seconds on my dual 500 MHz Pentium III machine. The
file is 3721 lines, 105,407 characters. This is just loading the file;
I'm not trying to edit it. I haven't yet been bugged enough to try
tracking down the problem. If there is anything you want me to try, let
me know.
Incidentally, this is the value of font-lock-defaults under PVS:
(pvs-font-lock-keywords nil t)
So the case-fold argument is t. This is the value of pvs-font-lock-keywords:
("\\b[aA][nN][dD]\\b\\|\\b[aA][nN][dD][tT][hH][eE][nN]\\b\\|\\b[aA][rR][rR][aA][yY]\\b\\|\\b[aA][sS][sS][uU][mM][iI][nN][gG]\\b\\|\\b[aA][sS][sS][uU][mM][pP][tT][iI][oO][nN]\\b\\|\\b[aA][uU][tT][oO][__][rR][eE][wW][rR][iI][tT][eE]\\b\\|\\b[aA][uU][tT][oO][__][rR][eE][wW][rR][iI][tT][eE][++]\\b\\|\\b[aA][uU][tT][oO][__][rR][eE][wW][rR][iI][tT][eE][--]\\b\\|\\b[aA][xX][iI][oO][mM]\\b\\|\\b[bB][eE][gG][iI][nN]\\b\\|\\b[bB][uU][tT]\\b\\|\\b[bB][yY]\\b\\|\\b[cC][aA][sS][eE][sS]\\b\\|\\b[cC][hH][aA][lL][lL][eE][nN][gG][eE]\\b\\|\\b[cC][lL][aA][iI][mM]\\b\\|\\b[cC][lL][oO][sS][uU][rR][eE]\\b\\|\\b[cC][oO][nN][dD]\\b\\|\\b[cC][oO][nN][jJ][eE][cC][tT][uU][rR][eE]\\b\\|\\b[cC][oO][nN][tT][aA][iI][nN][iI][nN][gG]\\b\\|\\b[cC][oO][nN][vV][eE][rR][sS][iI][oO][nN]\\b\\|\\b[cC][oO][nN][vV][eE][rR][sS][iI][oO][nN][++]\\b\\|\\b[cC][oO][nN][vV][eE][rR][sS][iI][oO][nN][--]\\b\\|\\b[cC][oO][rR][oO][lL][lL][aA][rR][yY]\\b\\|\\b[dD][aA][tT][aA][tT][yY][pP][eE]\\b\\|\\b[eE][lL][sS][eE]\\b\\|\\b[eE!
][lL][sS][iI][fF]\\b\\|\\b[eE][nN][dD]\\b\\|\\b[eE][nN][dD][aA][sS][sS][uU][mM][iI][nN][gG]\\b\\|\\b[eE][nN][dD][cC][aA][sS][eE][sS]\\b\\|\\b[eE][nN][dD][cC][oO][nN][dD]\\b\\|\\b[eE][nN][dD][iI][fF]\\b\\|\\b[eE][nN][dD][tT][aA][bB][lL][eE]\\b\\|\\b[eE][xX][iI][sS][tT][sS]\\b\\|\\b[eE][xX][pP][oO][rR][tT][iI][nN][gG]\\b\\|\\b[fF][aA][cC][tT]\\b\\|\\b[fF][aA][lL][sS][eE]\\b\\|\\b[fF][oO][rR][aA][lL][lL]\\b\\|\\b[fF][oO][rR][mM][uU][lL][aA]\\b\\|\\b[fF][rR][oO][mM]\\b\\|\\b[fF][uU][nN][cC][tT][iI][oO][nN]\\b\\|\\b[hH][aA][sS][__][tT][yY][pP][eE]\\b\\|\\b[iI][fF]\\b\\|\\b[iI][fF][fF]\\b\\|\\b[iI][mM][pP][lL][iI][eE][sS]\\b\\|\\b[iI][mM][pP][oO][rR][tT][iI][nN][gG]\\b\\|\\b[iI][nN]\\b\\|\\b[iI][nN][dD][uU][cC][tT][iI][vV][eE]\\b\\|\\b[jJ][uU][dD][gG][eE][mM][eE][nN][tT]\\b\\|\\b[lL][aA][mM][bB][dD][aA]\\b\\|\\b[lL][aA][wW]\\b\\|\\b[lL][eE][mM][mM][aA]\\b\\|\\b[lL][eE][tT]\\b\\|\\b[lL][iI][bB][rR][aA][rR][yY]\\b\\|\\b[mM][aA][cC][rR][oO]\\b\\|\\b[mM][eE][aA][sS][uU][rR][eE]\\b\\|\!
\b[nN][oO][nN][eE][mM][pP][tT][yY][__][tT][yY][pP][eE]\\b\\|\\b[nN][oO][tT]\\b\\|\\b[oO]\\b\\|\\b[oO][bB][lL][iI][gG][aA][tT][iI][oO][nN]\\b\\|\\b[oO][fF]\\b\\|\\b[oO][rR]\\b\\|\\b[oO][rR][eE][lL][sS][eE]\\b\\|\\b[pP][oO][sS][tT][uU][lL][aA][tT][eE]\\b\\|\\b[pP][rR][oO][pP][oO][sS][iI][tT][iI][oO][nN]\\b\\|\\b[rR][eE][cC][uU][rR][sS][iI][vV][eE]\\b\\|\\b[sS][uU][bB][lL][eE][mM][mM][aA]\\b\\|\\b[sS][uU][bB][tT][yY][pP][eE][sS]\\b\\|\\b[sS][uU][bB][tT][yY][pP][eE][__][oO][fF]\\b\\|\\b[tT][aA][bB][lL][eE]\\b\\|\\b[tT][hH][eE][nN]\\b\\|\\b[tT][hH][eE][oO][rR][eE][mM]\\b\\|\\b[tT][hH][eE][oO][rR][yY]\\b\\|\\b[tT][rR][uU][eE]\\b\\|\\b[tT][yY][pP][eE]\\b\\|\\b[tT][yY][pP][eE][++]\\b\\|\\b[vV][aA][rR]\\b\\|\\b[wW][hH][eE][nN]\\b\\|\\b[wW][hH][eE][rR][eE]\\b\\|\\b[wW][iI][tT][hH]\\b\\|\\b[xX][oO][rR]\\b"
("\\(<|\\||-\\||->\\||=\\||>\\|\\[\\]\\|/\\\\\\)" 1
font-lock-function-name-face) ("\\((#\\|#)\\|\\[#\\|#\\]\\)" 0
font-lock-pvs-record-parens-face) ("\\((:\\|:)\\|(|\\||)\\|(\\|)\\)!
" 1 font-lock-pvs-parens-face) ("\\(\\[|\\||\\]\\||\\[\\|\\]|\\|||\\)" 1
font-lock-pvs-table-face) ("\\({\\||\\|}\\)" 1 font-lock-pvs-set-brace-face)
("\\(\\[\\|->\\|\\]\\)" 1 font-lock-pvs-function-type-face)
("\\(!\\|!!\\|#\\|##\\|\\$\\|\\$\\$\\|&\\|&&\\|\\*\\|\\*\\*\\|\\+\\|\\+\\+\\|-\\|/\\|//\\|/=\\|/\\\\\\|::\\|:=\\|<\\|<-\\|<<\\|<<=\\|<=\\|<=>\\|<>\\|<|\\|=\\|==\\|==>\\|=>\\|>\\|>=\\|>>\\|>>=\\|@\\|@@\\|\\[\\]\\|\\\\/\\|\\^\\|\\^\\^\\||-\\||->\\||=\\||>\\|~\\)"
1 font-lock-function-name-face))
I figured that since case-fold was t, I could change all of those [lower
upper] pairs to just the lower-case letter. Doing so seems to have
reduced the font locking time by about 1 second, but I have not done
this scientifically (i.e., with repeated experiments). I was going to
try using regexp-opt to see if that sped things up any more, but I can't
use '\b' in the input to that function, and I don't see an easy way to
glom it on afterwards. How have others handled the need to match only
entire words?
Also incidentally, has anyone noticed the comment about XEmacs in the
documentation for the variable jde-java-font-lock-max-names-by-regexp?
--
Jerry James