comparison man/internals/internals.texi @ 1024:ccaf90c5a53a

[xemacs-hg @ 2002-10-02 09:29:37 by stephent] 21.4 -> R21.5 stuff manual improvements <87k7l1p6su.fsf@tleepslib.sk.tsukuba.ac.jp> regexp tests <87fzvpp6mf.fsf@tleepslib.sk.tsukuba.ac.jp> add-to-list doc Ville Skyttä <87bs6dp6io.fsf@tleepslib.sk.tsukuba.ac.jp> Move filename associations Ville Skyttä <877kh1p6ee.fsf@tleepslib.sk.tsukuba.ac.jp> lookup-syntax-properties <87admil2e0.fsf_-_@tleepslib.sk.tsukuba.ac.jp> fix stale submatches <873crpp50v.fsf_-_@tleepslib.sk.tsukuba.ac.jp> info for developers <87y99hnqc4.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 02 Oct 2002 09:31:40 +0000
parents ea6a06f7bf2c
children 2c2ff019dd33
comparison
equal deleted inserted replaced
1023:ce9bdd48654f 1024:ccaf90c5a53a
3241 commands: @code{quantify-start-recording-data}, 3241 commands: @code{quantify-start-recording-data},
3242 @code{quantify-stop-recording-data} and @code{quantify-clear-data}. 3242 @code{quantify-stop-recording-data} and @code{quantify-clear-data}.
3243 3243
3244 If you want to make XEmacs faster, target your favorite slow benchmark, 3244 If you want to make XEmacs faster, target your favorite slow benchmark,
3245 run a profiler like Quantify, @code{gprof}, or @code{tcov}, and figure 3245 run a profiler like Quantify, @code{gprof}, or @code{tcov}, and figure
3246 out where the cycles are going. Specific projects: 3246 out where the cycles are going. In many cases you can localize the
3247 problem (because a particular new feature or even a single patch
3248 elicited it). Don't hesitate to use brute force techniques like a
3249 global counter incremented at strategic places, especially in
3250 combination with other performance indications (@emph{e.g.}, degree of
3251 buffer fragmentation into extents).
3252
3253 Specific projects:
3247 3254
3248 @itemize @bullet 3255 @itemize @bullet
3249 @item 3256 @item
3250 Make the garbage collector faster. Figure out how to write an 3257 Make the garbage collector faster. Figure out how to write an
3251 incremental garbage collector. 3258 incremental garbage collector.
3254 Unfortunately, you will then need a C compiler and a more fully 3261 Unfortunately, you will then need a C compiler and a more fully
3255 developed module system. 3262 developed module system.
3256 @item 3263 @item
3257 Speed up redisplay. 3264 Speed up redisplay.
3258 @item 3265 @item
3259 Speed up syntax highlighting. Maybe moving some of the syntax 3266 Speed up syntax highlighting. It was suggested that ``maybe moving some
3260 highlighting capabilities into C would make a difference. 3267 of the syntax highlighting capabilities into C would make a
3268 difference.'' Wrong idea, I think. When processing one large file a
3269 particular low-level routine was being called 40 @emph{million} times
3270 simply for @emph{one} call to @code{newline-and-indent}. Syntax
3271 highlighting needs to be rewritten to use a reliable, fast parser, then
3272 to trust the pre-parsed structure, and only do re-highlighting locally
3273 to a text change. Modern machines are fast enough to implement such
3274 parsers in Lisp; but no machine will ever be fast enough to deal with
3275 quadratic (or worse) algorithms!
3261 @item 3276 @item
3262 Implement tail recursion in Emacs Lisp (hard!). 3277 Implement tail recursion in Emacs Lisp (hard!).
3263 @end itemize 3278 @end itemize
3264 3279
3265 Unfortunately, Emacs Lisp is slow, and is going to stay slow. Function 3280 Unfortunately, Emacs Lisp is slow, and is going to stay slow. Function
4770 primitives for scanning over text based on syntax tables. This is used, 4785 primitives for scanning over text based on syntax tables. This is used,
4771 for example, to find the matching parenthesis in a command such as 4786 for example, to find the matching parenthesis in a command such as
4772 @code{forward-sexp}, and by @file{font-lock.c} to locate quoted strings, 4787 @code{forward-sexp}, and by @file{font-lock.c} to locate quoted strings,
4773 comments, etc. 4788 comments, etc.
4774 4789
4790 @c #### Break this out into a separate node somewhere!
4791 Syntax codes are implemented as bitfields in an int. Bits 0-6 contain
4792 the syntax code itself, bit 7 is a special prefix flag used for Lisp,
4793 and bits 16-23 contain comment syntax flags. From the Lisp programmer's
4794 point of view, there are 11 flags: 2 styles X 2 characters X @{start,
4795 end@} flags for two-character comment delimiters, 2 style flags for
4796 one-character comment delimiters, and the prefix flag.
4797
4798 Internally, however, the characters used in multi-character delimiters
4799 will have non-comment-character syntax classes (@emph{e.g.}, the
4800 @samp{/} in C's @samp{/*} comment-start delimiter has ``punctuation''
4801 (here meaning ``operator-like'') class in C modes). Thus in a mixed
4802 comment style, such as C++'s @samp{//} to end of line, is represented by
4803 giving @samp{/} the ``punctuation'' class and the ``style b first
4804 character of start sequence'' and ``style b second character of start
4805 sequence'' flags. The fact that class is @emph{not} punctuation allows
4806 the syntax scanner to recognize that this is a multi-character
4807 delimiter. The @samp{newline} character is given (single-character)
4808 ``comment-end'' @emph{class} and the ``style b first character of end
4809 sequence'' @emph{flag}. The ``comment-end'' class allows the scanner to
4810 determine that no second character is needed to terminate the comment.
4775 4811
4776 4812
4777 @example 4813 @example
4778 casefiddle.c 4814 casefiddle.c
4779 @end example 4815 @end example