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

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

bug#20887: 'make bootstrap' now verrrry slow due to recent isearch chang


From: Eli Zaretskii
Subject: bug#20887: 'make bootstrap' now verrrry slow due to recent isearch changes
Date: Thu, 25 Jun 2015 18:03:57 +0300

> Date: Thu, 25 Jun 2015 00:37:51 +0100
> From: Artur Malabarba <address@hidden>
> Cc: address@hidden
> 
> I think I see now. Reading the code for `get-char-code-property' shows
> that I had to call a function stored in the extra slot.
> Calling that function on the table seems to be sufficient to populate it.

Indeed, the Unicode tables are tricky, in that with some of them you
need to call the function stored in the 1st extra slot to reconstruct
the value for a character.  (And if there's no function in that extra
slot, you should use get-unicode-property-internal to decode the
value.)

However, I think the version you pushed can be further improved.  For
starters, you don't need to populate the table first, and only then
use it; you can produce the property value for a character and use it
in the same call to map-char-table.  For example, the following
snippet loops only once over the table, and does its job in about 2
sec:

  (let* ((table (unicode-property-table-internal 'decomposition))
         (func (char-table-extra-slot table 1)))
    (map-char-table
     (lambda (key val)
       (if (consp key)
           (message "%s %s" key (funcall func (car key) val table))
         (message "%s %s" key (funcall func key val table))))
     table))

All you need is replace the silly 'message' calls with the body of
your processing code (and handle all the characters in a range of
codepoints, not just the first one).

Your code also calls unicode-property-table-internal twice, and the
above method will solve that as well.

Thanks.





reply via email to

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