unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ryo Furue <furue@hawaii.edu>
Cc: 4771-done@debbugs.gnu.org
Subject: bug#4771: 23.1; slow to interpret anthy maps
Date: Mon, 19 Sep 2011 15:56:41 -0400	[thread overview]
Message-ID: <jwvr53cjotq.fsf-monnier+gnus-read-ephemeral-bug@gnu.org> (raw)
In-Reply-To: <20091020.174229.193976912.furue@hawaii.edu> (Ryo Furue's message of "Tue, 20 Oct 2009 17:42:29 -1000 (HST)")

>   $ time /usr/bin/emacs23 -q --eval '(progn (load-library "anthy") (load "~/lib/emacs/anthy-el-my.el")(kill-emacs))'                                    
>   real    0m8.293s
>   user    0m1.244s
>   sys     0m0.036s
>   $ time /usr/bin/emacs22 -q --eval '(progn (load-library "anthy") (load "~/lib/emacs/anthy-el-my.el")(kill-emacs))'
>   real    0m1.197s
>   user    0m0.164s
>   sys     0m0.040s

AFAICT, anthy-el-my.el mostly calls functions which send some text to
a sub-process and then wait for an answer.  It appears from the above
measurement, then that a large part of the time is spent waiting (see
the difference between `real' time and `user' time).

In the current anthy.el I see the following core communication function:

(defun anthy-do-send-recv-command (cmd)
  (if (not anthy-agent-process)
      (anthy-check-agent))
  (let ((old-buffer (current-buffer)))
    (unwind-protect
	(progn
	  (set-buffer anthy-working-buffer)
	  (erase-buffer)
	  (process-send-string anthy-agent-process cmd)
	  (while (= (buffer-size) 0)
	    (accept-process-output nil 0 anthy-accept-timeout))
	  (read (buffer-string)))
      (set-buffer old-buffer))))

as well as the following initialization:

   (defvar anthy-accept-timeout 50)
   (if (string-match "^22\." emacs-version)
       (setq anthy-accept-timeout 1))

So could it simply be that accept-process-output always waits the
full timeout?  There are 152 calls to anthy-change-hiragana-map in
anthy-el-my.el.
So in Emacs-22 this would result in about 152 * 1ms = 152ms
of wasted waiting time (negligible) whereas with any other version you'd
get about 152 * 50ms = 7.5s of wasted waiting time.
So I think the problem is in anthy.el.


        Stefan





  parent reply	other threads:[~2011-09-19 19:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21  3:42 bug#4771: 23.1; slow to interpret anthy maps Ryo Furue
2011-09-18  9:01 ` Lars Magne Ingebrigtsen
2011-09-19 19:56 ` Stefan Monnier [this message]
2011-09-21 16:32   ` Lars Magne Ingebrigtsen

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=jwvr53cjotq.fsf-monnier+gnus-read-ephemeral-bug@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=4771-done@debbugs.gnu.org \
    --cc=furue@hawaii.edu \
    /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).