bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53606: 29.0.50; Very slow Customize buffer for bibtex-biblatex-entry


From: Mauro Aranda
Subject: bug#53606: 29.0.50; Very slow Customize buffer for bibtex-biblatex-entry-alist
Date: Sat, 9 Sep 2023 19:23:16 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]