[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ligature support
From: |
Eli Zaretskii |
Subject: |
Re: Ligature support |
Date: |
Sat, 06 Nov 2021 10:32:33 +0200 |
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 06 Nov 2021 00:02:57 +0100
>
> (dolist (c (append (number-sequence ?A ?Z)
> (number-sequence ?a ?z)))
> (aset composition-function-table
> c
> (list (vector (concat (string c) "[^ \n\t]+") 0 #'font-shape-gstring))))
>
> So that fixes the kerning (this is with the proportional Deja Vu font).
> And with that, scrolling through xdisp.c is 30% slower.
30% slowdown is already a bad sign. However, scrolling through
xdisp.c is not representative enough, since most of that is source
code which will not ligate given the above rules. If you want to make
a realistic comparison for xdisp.c, you need ligature rules for
program symbols, not for ASCII letters.
I tried the above with the King James Bible text, which you can
download from here:
http://corpus.canterbury.ac.nz/resources/large.tar.gz
It's a 30K line, 4MB file. With that, running the scrolling benchmark
whose code is shown below produces:
without ligatures: 30.4 sec and 28 GC cycles
with ligatures: 91.1 sec and 91 GC cycles
(This is an unoptimized build of Emacs 29; with optimized builds
and/or faster CPUs you will see shorter times, but the ratio should be
similar.)
Are we willing to make our redisplay 3 times slower with plain ASCII
text?
I think the current design of character compositions in Emacs is
inappropriate for sending all the text via the shaping engine. It was
designed on the assumption that composed characters will be rare in
"normal" usage, and will only be massive in some specific scripts
where this is unavoidable, like Arabic and Hangul. If we want to call
the shaper for everything we display, we should radically change how
this is designed and implemented.
Here's the function I used for the benchmark:
(defun scroll-up-benchmark ()
(interactive)
(let ((oldgc gcs-done)
(oldtime (float-time)))
(condition-case nil (while t (scroll-up) (redisplay))
(error (message "GCs: %d Elapsed time: %f seconds"
(- gcs-done oldgc) (- (float-time) oldtime))))))
- Re: Ligature support, (continued)
- Re: Ligature support, Stefan Kangas, 2021/11/05
- Re: Ligature support, Eli Zaretskii, 2021/11/05
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/05
- Re: Ligature support, Eli Zaretskii, 2021/11/05
- Re: Ligature support, Eli Zaretskii, 2021/11/05
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/05
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/05
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/05
- Re: Ligature support,
Eli Zaretskii <=
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/06
- Re: Ligature support, Eli Zaretskii, 2021/11/06
- Re: Ligature support, Lars Ingebrigtsen, 2021/11/06
- Re: Ligature support, Eli Zaretskii, 2021/11/06
- Re: Ligature support, chad, 2021/11/12
- Re: Ligature support, Richard Stallman, 2021/11/14
- Re: Ligature support, Stefan Kangas, 2021/11/15
- Re: Ligature support, Richard Stallman, 2021/11/17
- Re: Ligature support, Eli Zaretskii, 2021/11/15
- Re: Ligature support, Eli Zaretskii, 2021/11/06