unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 53606@debbugs.gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#53606: 29.0.50; Very slow Customize buffer for bibtex-biblatex-entry-alist
Date: Sat, 9 Sep 2023 19:23:16 -0300	[thread overview]
Message-ID: <47a462c3-7f5d-02a3-4287-5e561cb2a008@gmail.com> (raw)
In-Reply-To: <87sft7gawc.fsf@gnus.org>

Lars Ingebrigtsen <larsi@gnus.org> writes:

 > `M-x customize-option RET bibtex-biblatex-entry-alist RET'
 >
 > takes a very long time -- more than 20 seconds on this laptop.  It's a
 > long alist, but it shouldn't take that long.

I don't have any concrete ideas on how to speed it up on the Widget
library side.  But looking at the defcustom for
bibtex-biblatex-entry-alist I noted two things that can help to create
the Customize buffer more quickly:

1) It uses a custom widget derived from the lazy widget, but doesn't
provide a :tag.  That makes it look awful and giving it a proper :tag 
reduced
the buffer creation time somewhat in my testings.

2) More importantly, the bibtex-entry-alist widget looks like this:
(define-widget 'bibtex-entry-alist 'lazy
   "Format of `bibtex-BibTeX-entry-alist' and friends."
   :type '(repeat (group (string :tag "Entry type")
                         (string :tag "Documentation")
                         (repeat :tag "Required fields"
                                 (group (string :tag "Field")
                                        (option (choice :tag "Comment" 
:value nil
                                                        (const nil) string))
                                        (option (choice :tag "Init" 
:value nil
                                                        (const nil) 
string function))
                                        (option (choice :tag 
"Alternative" :value nil
                                                        (const nil) 
integer))))
                         (repeat :tag "Crossref fields"
                                 (group (string :tag "Field")
                                        (option (choice :tag "Comment" 
:value nil
                                                        (const nil) string))
                                        (option (choice :tag "Init" 
:value nil
                                                        (const nil) 
string function))
                                        (option (choice :tag 
"Alternative" :value nil
                                                        (const nil) 
integer))))
                         (repeat :tag "Optional fields"
                                 (group (string :tag "Field")
                                        (option (choice :tag "Comment" 
:value nil
                                                        (const nil) string))
                                        (option (choice :tag "Init" 
:value nil
                                                        (const nil) 
string function))
                                        (option (choice :tag 
"Alternative" :value nil
                                                        (const nil) 
integer)))))))

Why combine option and choice? That's redundant, specially since the
choice widget allows for the nil value.  Removing the `option's and just
leaving the `choice's should be equivalent in functionality, and in my
testings reduced the creation time to the half.

I ran customize-option 5 times and got:

With `option':
(172.526219636 69 6.120602505999997)

Without `option':
(86.260726994 42 3.5430049540000113)

This is without native compilation.

Based on the above results and since there's no lost in functionality, I
propose to make the changes to the bibtex-entry-alist widget. It is a
net gain in speed, and it might make the wait bearable.






  reply	other threads:[~2023-09-09 22:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 15:03 bug#53606: 29.0.50; Very slow Customize buffer for bibtex-biblatex-entry-alist Lars Ingebrigtsen
2023-09-09 22:23 ` Mauro Aranda [this message]
2023-09-09 22:51   ` Mauro Aranda
2023-09-10  5:01     ` Eli Zaretskii
2023-09-10  9:49       ` Mauro Aranda
2023-09-10 10:43         ` Eli Zaretskii
2023-09-10 10:50           ` Ihor Radchenko
2023-09-10 12:41           ` Mauro Aranda
2023-09-18 11:07             ` Mauro Aranda
2023-12-21 11:51               ` Ihor Radchenko

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=47a462c3-7f5d-02a3-4287-5e561cb2a008@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=53606@debbugs.gnu.org \
    --cc=larsi@gnus.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).