emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: set-fontset-font is slow if the fontset is specified by a long name


From: Kenichi Handa
Subject: Re: set-fontset-font is slow if the fontset is specified by a long name
Date: Mon, 25 Oct 2004 11:01:07 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, YAMAMOTO Mitsuharu <address@hidden> writes:

> When a fontset name is specified in a long format, set-fontset-font
> takes much time to complete.  For example, the evaluation of the
> following expression terminates instantly.

>   (dotimes (i 100)
>     (set-fontset-font "fontset-default"
>                     'latin-iso8859-1
>                     '("helvetica" . "iso8859-1")))

> But if we replace "fontset-default" with
> "-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default", then it becomes much
> slower.

>   (dotimes (i 100)
>     (set-fontset-font "-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"
>                     'latin-iso8859-1
>                     '("helvetica" . "iso8859-1")))

set-fontset-font converts NAME into a regular expression
while converting every '*' into '.*'.  So, the above
slowness is because of this regular-expression processing is
slow.

(string-match "-.*-.*-.*-.*-.*-.*-.*-.*-.*-.*-.*-.*-fontset-default"
              "-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"))

I fixed the code so that convert '*' to "[^-]*" if full XLFD
is given.  This speedups the second example, but still the
first one is faster because it's registered in
fontset-alias-alist.

If you want to make this faster in 21.3, please try


---
Ken'ichi HANDA
address@hidden




reply via email to

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