unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Artur Malabarba <bruce.connor.am@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 20887@debbugs.gnu.org
Subject: bug#20887: 'make bootstrap' now verrrry slow due to recent isearch changes
Date: Thu, 25 Jun 2015 18:32:51 +0100	[thread overview]
Message-ID: <CAAdUY-LZTuB35KD0=-ErjnYRxh+nDhjsB97uG2xgyAGXj5mUpg@mail.gmail.com> (raw)
In-Reply-To: <838ub7eso2.fsf@gnu.org>

> 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).

The "handle all characters in a range" part is the issue.

For me, the first time that snippet is run it calls the lambda a total
of 101 times (and barely takes an instant).
More importantly, every single time the key is a range, and the value
returned by the `funcall' is actually the decomposition of the *first*
char in that range (not the full range).
For instance, one of the messages I get from your snippet is:
    (64256 . 64383) (compat 102 102)

But if you call (get-char-code-property 64257 'decomposition) (note
the 7) you'll get a decomposition of (compat 102 105).

Maybe I'm missing some simplification here.
I'm aware I could run a loop inside the lambda going from (car key) to
(cdr key), and then do the `(funcall func ...)' on each item in the
range, but I fail to see how that would be faster than running a
second map-char-table. In fact, the number of steps involved is much
larger if you loop:
 - the current version has a map of 100 steps and another of 5721,
 - your proposal would have a map of 100 steps, each containing a loop
of about 120 steps, which totals to over 12000 steps (I counted).

Again, maybe I'm missing something, or maybe looping would be much
faster than that second `map-char-table', but it seems to me like it
would just be doing more work.

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

Yes, that was an oversight. My intention was to reuse the `table' var.
I'll fix that.





  reply	other threads:[~2015-06-25 17:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  1:35 bug#20887: 'make bootstrap' now verrrry slow due to recent isearch changes Paul Eggert
2015-06-24  7:06 ` Glenn Morris
2015-06-24  7:52   ` Artur Malabarba
2015-06-24 13:36     ` Paul Eggert
2015-06-24 14:28       ` Artur Malabarba
2015-06-24 15:05         ` Eli Zaretskii
2015-06-24 15:19           ` Eli Zaretskii
2015-06-24 17:18             ` Artur Malabarba
2015-06-24 19:14               ` Eli Zaretskii
2015-06-24 20:05                 ` Artur Malabarba
2015-06-24 23:17                   ` Artur Malabarba
2015-06-24 23:37                     ` Artur Malabarba
2015-06-25 15:03                       ` Eli Zaretskii
2015-06-25 17:32                         ` Artur Malabarba [this message]
2015-06-26  7:52                           ` Eli Zaretskii
2015-06-26 11:41                             ` Artur Malabarba
2015-06-26 13:32                               ` Eli Zaretskii
2015-06-24 17:15           ` Glenn Morris
2015-06-24 17:38             ` Artur Malabarba
2015-06-24 15:55     ` Glenn Morris
2015-06-24 13:31   ` Paul Eggert
2015-06-24 15:58     ` Glenn Morris
2015-06-25  2:48       ` Paul Eggert
2015-06-25 23:21         ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAdUY-LZTuB35KD0=-ErjnYRxh+nDhjsB97uG2xgyAGXj5mUpg@mail.gmail.com' \
    --to=bruce.connor.am@gmail.com \
    --cc=20887@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).