unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Leo Liu <sdl.web@gmail.com>, 11906@debbugs.gnu.org
Subject: bug#11906: 24.1; completion-at-point failures
Date: Wed, 22 May 2013 03:39:13 +0400	[thread overview]
Message-ID: <87li776gym.fsf@yandex.ru> (raw)
In-Reply-To: <jwv7gj69oif.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 10 May 2013 23:40:39 -0400")

I've seen this very same problem when writing and using a
completion-at-point function for Ruby, via external live process, so
it's also comparably slow.

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> The difference between 2 and 3 calls shouldn't be sufficiently large to
>>> go from "acceptable" to "terrible delay".
>> It is a difference between 1 and 3 calls because a user can also run
>> octave in terminal and find that how responsive it actually is.
>
> But the generic completion code can't easily go down to a single call in
> the general case.

Why not?

I have a function, called `robe-complete-thing', which is used as a
"dynamic completion table" via `completion-table-dynamic'.

Whenever I press `C-M-i' in a relevant buffer, `robe-complete-thing'
gets called 2 times if the symbol is "complete, but not unique", or 3
times if the symbol is not complete, and the *Completions* buffer should
be displayed.

Whatever code drives this logic, I imagine all places that access the
dynamic completion table do that is specific order. And since they all
look up completions for the same term, can't the first of them save the
lookup result, so that all other places will use the saved value? All
that in the scope of one `complete-symbol' call.

>> I think if completion-at-point can work well when there is a 2-second
>> cost in a completion-at-point function, it can provide an excellent
>> experience.
>
> Obviously it can, via caching.  Most completion tables which incur
> a significant computation code should use caching, but we can't use
> caching unconditionally, because it's hard to come up with a general
> conditions under which the cache can be reused or needs to be flushed.

The one most visible problem case is when the dynamic completion table
is called several times at once for the same term.

Caching is a possible solution, but it doesn't seem to me that caching
anything more than the last request-response pair would be too useful.

> As mentioned, we could try and provide a generic completion-table cache
> so as to make it easier to write completion tables that have
> a significant computation cost.  Patches welcome.

So, suppose we do provide a caching function. Would it cache more than
just one pair? If not, it won't be too hard to do in
`completion-table-dynamic', or in an additional function that would wrap
FUN and then pass it to `completion-table-dynamic'.





  parent reply	other threads:[~2013-05-21 23:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  5:54 bug#11906: 24.1; completion-at-point failures Leo
2012-07-12 14:00 ` Stefan Monnier
2013-05-10  6:38   ` Leo Liu
2013-05-10 20:36     ` Stefan Monnier
2013-05-11  1:50       ` Leo Liu
2013-05-11  3:40         ` Stefan Monnier
2013-05-11  4:47           ` Leo Liu
2013-05-11 14:51             ` Stefan Monnier
2013-05-13  1:28               ` Leo Liu
2013-05-13 15:27                 ` Stefan Monnier
2013-05-14  0:56                   ` Leo Liu
2013-05-14  2:53                     ` Stefan Monnier
2013-05-14  3:30                       ` Leo Liu
2013-05-11 20:18             ` Andreas Röhler
2013-05-11 23:11           ` Daimrod
2013-05-13 15:28             ` Stefan Monnier
2013-05-21 23:39           ` Dmitry Gutov [this message]
2013-05-22 19:16             ` Stefan Monnier
2013-12-05  3:23               ` Dmitry Gutov
2013-12-05  4:33                 ` Stefan Monnier
2013-12-06  1:02                   ` Dmitry Gutov
2013-12-06  4:00                     ` Leo Liu
2013-12-06  4:32                       ` Dmitry Gutov
2013-12-06  5:36                         ` Leo Liu
2013-12-06 13:15                           ` Dmitry Gutov
2013-12-06 14:04                             ` Leo Liu
2013-12-06 17:35                               ` Stefan Monnier
2013-12-07  2:05                                 ` Leo Liu
2013-12-07 22:45                                   ` Stefan Monnier
2013-12-06 17:36                               ` Stefan Monnier
2013-12-07  2:02                               ` Dmitry Gutov
2013-12-07  2:40                                 ` Leo Liu
2013-12-07 16:13                                   ` Dmitry Gutov
2013-12-09  2:27                                     ` Leo Liu

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=87li776gym.fsf@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=11906@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sdl.web@gmail.com \
    /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).