unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Generation of tags for the current project on the fly
Date: Mon, 15 Jan 2018 07:37:49 +0200	[thread overview]
Message-ID: <83inc3znpu.fsf@gnu.org> (raw)
In-Reply-To: <259c557d-e3a3-c01b-9ba3-30df09d247ea@yandex.ru> (message from Dmitry Gutov on Mon, 15 Jan 2018 04:44:58 +0300)

> Cc: emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Mon, 15 Jan 2018 04:44:58 +0300
> 
> On 1/14/18 7:21 PM, Eli Zaretskii wrote:
> 
> >> OK, so if the user says yes, we "temporarily visit" to auto-generated
> >> tags table. Then the user saves a file and that table get invalidated
> >> (or via some other mechanism), and we want to index it again. Ask again?
> > 
> > No, I think asking once per project should be enough.
> 
> Until the end of the current Emacs session? And ask again after restart?

Yes.

> What about if the user switches to a different project and then back?

Ideally, don't ask anymore about that project.

> > I mean the first time the tags table is required might very well be at
> > the beginning of working on a project, at which time the project
> > source tree is not yet in the cache.
> 
> Yes, and? The user will need it to be indexed either way, right?

Yes, but my point was that col-cache times cannot be ignored.

> There's also another optimization opportunity: performing reindexing in 
> an asynchronous fashion, in the background (maybe after a timeout, too), 
> after any file is changed and saved. This one comes with its own 
> tradeoffs, though.

Doing that asynchronously could be an automatic action , not in need
of any user confirmation.  It complicates the implementation a bit,
but perhaps not too much, so this could be a good design choice.

> To measure the full time:
> 
> (benchmark 1 '(progn (etags--project-tags-cleanup) 
> (etags--maybe-use-project-tags)))

5.5 sec with warm cache.  This is with an unoptimized Emacs, btw, but
most of the time is spent by external programs, so perhaps this
doesn't matter.

> To measure the time to generate the list of files only:
> 
> (benchmark 1 '(all-completions "" (project-file-completion-table 
> (project-current) (list default-directory))))

0.95 sec with cold cache, 0.23 with warm cache.

> >> 'git ls-files' will probably be faster still.
> > 
> > Yes, but that only works in Git repositories.
> 
> We can probably optimize for that use case these days. Git or some other 
> VCS is usually in place, especially in non-toy projects.

For the projects using Git, yes.

> How do we figure which files to visit? Do we just visit src/TAGS and 
> expect the rest to be 'include'-d.

I think just visit TAGS in the directory of the source whose symbol is
requested, or maybe use locate-dominating-file to look higher in the
tree if not found in the current directory.

> Here's another one: considering the reindexing costs are not always 
> negligible and depend on the size of a project, will there be actual 
> benefit to using the proposed scheme in GNU projects like Emacs, GCC and 
> others (those are the ones that use 'make TAGS')? Or is there a subset 
> of them, at least, which we expect to benefit?

That's a good question.  But if the tags table is automatically
produced in the background, the time this takes is much less
important, and having TAGS always up to date would be a valuable
feature.  FWIW, I do "make TAGS" in every large project I start
working on seriously, so at least for me this is important.



  reply	other threads:[~2018-01-15  5:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  1:02 Generation of tags for the current project on the fly Dmitry Gutov
2018-01-12  9:01 ` Eli Zaretskii
2018-01-12 13:52   ` Dmitry Gutov
2018-01-12 18:52     ` Eli Zaretskii
2018-01-14  2:05       ` Dmitry Gutov
2018-01-14 16:21         ` Eli Zaretskii
2018-01-15  1:44           ` Dmitry Gutov
2018-01-15  5:37             ` Eli Zaretskii [this message]
2018-01-15 18:50               ` Dmitry Gutov
2018-01-16 17:50                 ` Eli Zaretskii
2018-01-16 21:56                   ` Dmitry Gutov
2018-01-17 15:40                     ` Eli Zaretskii
2018-01-17 19:43                       ` Dmitry Gutov
2018-01-17 20:12                         ` Eli Zaretskii
2018-01-17 22:19                           ` Dmitry Gutov
2018-01-17 22:28                             ` Dmitry Gutov
2018-01-17 22:02                 ` Tom Tromey
2018-01-17 22:44                   ` Dmitry Gutov
2018-01-17 23:20                     ` Tom Tromey
2018-01-18  0:14                       ` Dmitry Gutov
2018-01-18  1:30                         ` Dmitry Gutov
2018-01-19  1:21                         ` Dmitry Gutov
2018-01-20 22:15                           ` Tom Tromey
2018-01-20 23:57                           ` Tom Tromey
2018-01-21 12:26                             ` Dmitry Gutov
2018-01-30  4:45                               ` Tom Tromey
2018-02-04 23:32                                 ` Dmitry Gutov
2018-01-30  5:05                               ` Tom Tromey
2018-02-04 23:40                                 ` Dmitry Gutov
2018-02-05 17:06                                   ` Eli Zaretskii
2018-02-05 20:10                                     ` Dmitry Gutov
2018-02-06 19:36                                       ` Eli Zaretskii
2018-02-06 20:41                                         ` Dmitry Gutov
2018-02-07  3:26                                           ` Eli Zaretskii
2018-02-07  9:47                                             ` Dmitry Gutov
2018-02-07 21:30                                               ` Tom Tromey
2018-02-09  9:41                                                 ` Dmitry Gutov
2018-02-08 20:31                                               ` John Yates
2018-02-09  0:22                                                 ` Dmitry Gutov
2020-12-08 22:26                       ` Dmitry Gutov
2018-01-17 11:08               ` Dmitry Gutov
2018-01-15  1:50           ` John Yates
2018-01-15  5:42             ` Eli Zaretskii
2018-01-15 15:01               ` Dmitry Gutov
2018-01-15 17:21                 ` Eli Zaretskii
2018-01-15 17:45                   ` Dmitry Gutov
2018-01-15 20:56                     ` Matthias Meulien
2018-01-15 21:44                       ` Dmitry Gutov
2018-01-15 16:33               ` John Yates

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=83inc3znpu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@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).