On 10/9/23 09:41, Mauro Aranda wrote: > On 10/9/23 07:43, Eli Zaretskii wrote: > >> Date: Sun, 10 Sep 2023 06:49:29 -0300 > >> Cc: 53606@debbugs.gnu.org > >> From: Mauro Aranda > >> > >> On 10/9/23 02:01, Eli Zaretskii wrote: > >>  > Could you please profile this slow operation and post the completely > >>  > unfolded profile?  I think we should try to understand what exactly > >>  > takes so much time in this case. > >> > >> Here it is.  I also attach the result of C-x C-w in the report buffer, > >> just in case. > > > > So the hot spot seems to be widget-checklist-add-item, is that right? > > I think so.  The checklist widgets were my first suspects, since > creating them is rather slow. > > > And inside that widget-create-child and widget-apply? > > I don't think those functions could be the bottleneck.  Most likely it > is the widget-default-create function that those functions end up > calling.  So yes, widget-default-create in general, and > widget-checklist-value-create in particular should be investigated for > speeding them up, but I don't have any ideas at the moment. I focused on the format handling, since there's no need to insert the escape formats in the buffer.  So I rearranged the 4 functions that handle the format to avoid it and here are the figures I got, when running: (benchmark-run 5   (customize-option 'bibtex-biblatex-entry-alist)) From master, inserting either :format or :entry-format: (130.200276352 291 3.1221133909999996) Without inserting it: (38.244185927000004 266 2.795578699) | How?                 | Total elapsed time (5 repetitions) | Avg | Times faster | |----------------------+------------------------------------+-------+--------------| | inserting format     |                             130.20 | 26.04 |            1 | | not inserting format |                              38.24 | 7.65 |          3.4 | All data is without native compilation.  I'd appreciate if someone could at least run it once with native compilation, with and without my patch. I attach a patch with the changes, and the new profiler report, but I'm inclined to leave it as it is if the patch gets accepted.