Subject: Re: bug#23223: 25.0.92; Can xref-find-references be sped up?

From: Eli Zaretskii <[email-masked]>
Date: Wed, 13 Apr 2016 05:44:32 +0300

> Cc: [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Tue, 12 Apr 2016 23:26:13 +0300
> 
> Could you compare the lists of matches you get? E.g. C-x C-s on the xref 
> buffer in both cases, and then diff the results.

Attached.

--- x00	2016-04-13 05:42:17.702125000 +0300
+++ x01	2016-04-13 05:42:35.092750000 +0300
@@ -692,14 +692,162 @@
 2174:     i = find_interval (buffer_intervals (current_buffer), pos);
 2465:   INTERVAL i = buffer_intervals (current_buffer);
 D:/gnu/git/emacs/branch/src/keyboard.c
- 736:       && current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
-1410:       prev_buffer = current_buffer;
-1469:             buffer_before_last_command_or_undo = current_buffer;
-1516:       if (!NILP (BVAR (current_buffer, mark_active))
-1538: 		  && XMARKER (BVAR (current_buffer, mark))->buffer
-1553: 	      if (current_buffer != prev_buffer || MODIFF != prev_modiff)
-1562:       if (current_buffer == prev_buffer
+  736:       && current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
+ 1410:       prev_buffer = current_buffer;
+ 1469:             buffer_before_last_command_or_undo = current_buffer;
+ 1516:       if (!NILP (BVAR (current_buffer, mark_active))
+ 1538: 		  && XMARKER (BVAR (current_buffer, mark))->buffer
+ 1553: 	      if (current_buffer != prev_buffer || MODIFF != prev_modiff)
+ 1562:       if (current_buffer == prev_buffer
+ 1563: 	  && XBUFFER (XWINDOW (selected_window)->contents) == current_buffer
+ 1633:   eassert (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer);
+ 2833:       struct buffer *prev_buffer = current_buffer;
+ 2844:       if (current_buffer != prev_buffer)
+ 3905: 	  XSETBUFFER (obj, current_buffer);
+ 7392: 	if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
+ 7399: 	maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
+ 7945:       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
+ 7952:       maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
+ 8808:    If FIX_CURRENT_BUFFER, we restore current_buffer
+ 8935:   starting_buffer = current_buffer;
+ 9151: 		      != current_buffer)
+ 9163: 	      && current_buffer != starting_buffer)
+ 9201: 		      != current_buffer))
+ 9252: 		      && XBUFFER (XWINDOW (window)->contents) != current_buffer)
+ 9642: 		      < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size)
+11759:    * confused because it doesn't realize that the current_buffer was
+D:/gnu/git/emacs/branch/src/keymap.c
+1486: 	  && XBUFFER (XWINDOW (window)->contents) != current_buffer)
+1515:       Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
+1517:       Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
+1536: 					     current_buffer, Qlocal_map);
+1539: 					  current_buffer, Qkeymap);
+1677:   map = BVAR (current_buffer, keymap);
+1777:   bset_keymap (current_buffer, keymap);
+1787:   return BVAR (current_buffer, keymap);
+D:/gnu/git/emacs/branch/src/lread.c
+1470: 	  filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
+D:/gnu/git/emacs/branch/src/marker.c
+715:   for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
+750:       BUF_INC_POS (current_buffer, below_byte);
+D:/gnu/git/emacs/branch/src/minibuf.c
+422:   ambient_dir = BVAR (current_buffer, directory);
+538:       enable_multibyte = BVAR (current_buffer, enable_multibyte_characters);
+548:   bset_truncate_lines (current_buffer, Qnil);
+552:     bset_enable_multibyte_characters (current_buffer, enable_multibyte);
+557:      the current_buffer, so reset_buffer leaves buf's default
+563:     bset_directory (current_buffer, ambient_dir);
+571: 	    bset_directory (current_buffer,
+619:     if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
+649:   bset_keymap (current_buffer, map);
+658:   bset_undo_list (current_buffer, Qnil);
+D:/gnu/git/emacs/branch/src/print.c
+ 91:    struct buffer *old = current_buffer;					\
+ 97:      = !NILP (BVAR (current_buffer, enable_multibyte_characters));	\
+102:        if (XBUFFER (printcharfun) != current_buffer)			\
+111:        if (XMARKER (printcharfun)->buffer != current_buffer)		\
+128:        if (NILP (BVAR (current_buffer, enable_multibyte_characters))	\
+131:        if (! NILP (BVAR (current_buffer, enable_multibyte_characters))	\
+158: 	   && NILP (BVAR (current_buffer, enable_multibyte_characters)))\
+302: 	    = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+359: 	= !NILP (BVAR (current_buffer, enable_multibyte_characters));
+429: 		   : ! NILP (BVAR (current_buffer, enable_multibyte_characters))))
+543:   register struct buffer *old = current_buffer;
+551:   delete_all_overlays (current_buffer);
+552:   bset_directory (current_buffer, BVAR (old, directory));
+553:   bset_read_only (current_buffer, Qnil);
+554:   bset_filename (current_buffer, Qnil);
+555:   bset_undo_list (current_buffer, Qt);
+556:   eassert (current_buffer->overlays_before == NULL);
+557:   eassert (current_buffer->overlays_after == NULL);
+559:     (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
+563:   XSETBUFFER (buf, current_buffer);
+672:   struct buffer *previous = current_buffer;
+856:   struct buffer *old = current_buffer;
+D:/gnu/git/emacs/branch/src/process.c
+2194:     else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+3721:     else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+4604: 	      struct buffer *old_buffer = current_buffer;
+4612: 		  && (old_buffer != current_buffer
+4959: 	  struct buffer *old_buffer = current_buffer;
+4974: 	      && (old_buffer != current_buffer
+5377:   XSETBUFFER (obuffer, current_buffer);
+5378:   okeymap = BVAR (current_buffer, keymap);
+5462:       || ! EQ (current_buffer->keymap, okeymap))
+5497:       old_read_only = BVAR (current_buffer, read_only);
+5503:       bset_read_only (current_buffer, Qnil);
+5520:       if (NILP (BVAR (current_buffer, enable_multibyte_characters))
+5534: 	  && (b = XBUFFER (p->buffer), b != current_buffer))
+5563:       bset_read_only (current_buffer, old_read_only);
+5723: 	  struct buffer *cur = current_buffer;
+6559:   XSETBUFFER (obuffer, current_buffer);
+6560:   okeymap = BVAR (current_buffer, keymap);
+6607:       || ! EQ (current_buffer->keymap, okeymap))
+6720:       struct buffer *old = current_buffer;
+6730:       if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+6747:       tem = BVAR (current_buffer, read_only);
+6748:       bset_read_only (current_buffer, Qnil);
+6754:       bset_read_only (current_buffer, tem);
+D:/gnu/git/emacs/branch/src/search.c
+ 147:   cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
+ 226: 	      || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table)))
+ 275:   set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
+ 276: 			 BVAR (current_buffer, case_eqv_table));
+ 282: 			  (!NILP (BVAR (current_buffer, case_fold_search))
+ 283: 			   ? BVAR (current_buffer, case_canon_table) : Qnil),
+ 285: 			  !NILP (BVAR (current_buffer, enable_multibyte_characters)));
+ 333:     XSETBUFFER (last_thing_searched, current_buffer);
+ 391:   set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
+ 392: 			 BVAR (current_buffer, case_eqv_table));
+ 397: 			  (!NILP (BVAR (current_buffer, case_fold_search))
+ 398: 			   ? BVAR (current_buffer, case_canon_table) : Qnil),
+ 559:       multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ 670:   newline_cache = newline_cache_on_off (current_buffer);
+ 671:   if (current_buffer->base_buffer)
+ 672:     cache_buffer = current_buffer->base_buffer;
+ 674:     cache_buffer = current_buffer;
+1055:   set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
+1056: 			 BVAR (current_buffer, case_eqv_table));
+1059: 		      (!NILP (BVAR (current_buffer, case_fold_search))
+1060: 		       ? BVAR (current_buffer, case_canon_table)
+1062: 		      (!NILP (BVAR (current_buffer, case_fold_search))
+1063: 		       ? BVAR (current_buffer, case_eqv_table)
+1189: 			      !NILP (BVAR (current_buffer, enable_multibyte_characters)));
+1243: 		  XSETBUFFER (last_thing_searched, current_buffer);
+1287: 		  XSETBUFFER (last_thing_searched, current_buffer);
+1312:       bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+1528:   bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+1748:   bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+2159:   XSETBUFFER (last_thing_searched, current_buffer);
+2574:       bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+3220:     buf = current_buffer;
+3225:       old = current_buffer;
+D:/gnu/git/emacs/branch/src/syntax.c
+ 423: 	  gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
+ 563:   if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+ 590:   if (current_buffer == find_start_buffer
+ 640:   find_start_buffer = current_buffer;
+ 981:   return BVAR (current_buffer, syntax_table);
+1026:   bset_syntax_table (current_buffer, table);
+1029:   SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
+1233:     syntax_table = BVAR (current_buffer, syntax_table);
+1654:   multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
+2137:   multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
+2895: 		  if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
+D:/gnu/git/emacs/branch/src/term.c
+3692: 			 make_save_ptr_ptr (menu, current_buffer));
 D:/gnu/git/emacs/branch/src/textprop.c
+  83:   struct buffer *buf = XBUFFER (buffer), *old = current_buffer;
+  94:   bset_point_before_scroll (current_buffer, Qnil);
+ 525:     XSETBUFFER (object, current_buffer);
+ 566:     XSETBUFFER (object, current_buffer);
+ 610:     XSETBUFFER (object, current_buffer);
+ 622:       struct buffer *obuf = current_buffer;
+ 793:       if (BUFFERP (object) && current_buffer != XBUFFER (object))
+ 877:       if (BUFFERP (object) && current_buffer != XBUFFER (object))
+ 948:     XSETBUFFER (object, current_buffer);
+1015:     XSETBUFFER (object, current_buffer);
+1062:     XSETBUFFER (object, current_buffer);
 1112:     XSETBUFFER (object, current_buffer);
 1160:     XSETBUFFER (object, current_buffer);
 1360:     XSETBUFFER (object, current_buffer);