XEmacs 21.2.24 "Hecate".
[chise/xemacs-chise.git.1] / src / redisplay-output.c
index 06b78b3..f767790 100644 (file)
@@ -190,6 +190,27 @@ compare_runes (struct window *w, struct rune *crb, struct rune *drb)
   /* Do not compare the values of bufpos and endpos.  They do not
      affect the display characteristics. */
 
+  /* Note: (hanoi 6) spends 95% of its time in redisplay, and about
+     30% here. Not using bitfields for rune.type alone gives a redisplay
+     speed up of 10%.
+
+     #### In profile arcs run of a normal Gnus session this function
+     is run 6.76 million times, only to return 1 in 6.73 million of
+     those.
+
+     In addition a quick look GCC sparc assembly shows that GCC is not
+     doing a good job here.
+     1. The function is not inlined (too complicated?)
+     2. It seems to be reloading the crb and drb variables all the
+     time.
+     3. It doesn't seem to notice that the second half of these if's
+     are really a switch statement.
+
+     So I (JV) conjecture
+
+     #### It would really be worth it to arrange for this function to
+     be (almost) a single call to memcmp. */
+  
   if ((crb->findex != drb->findex) ||
       (WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
     return 0;
@@ -1202,14 +1223,14 @@ redisplay_output_layout (struct window *w,
   /* We bogusly don't take f->extents_changed and f->glyphs_changed
      into account. This is because if we do we always redisplay the
      entire layout. So far I have seen no ill effects to we'll see. */
-  int frame_changed = (f->buffers_changed ||
-                      f->clip_changed ||
-                      f->faces_changed    ||
-                      f->frame_changed    ||
-                      f->modeline_changed ||
-                      f->subwindows_changed ||
-                      f->windows_changed ||
-                      f->windows_structure_changed);
+  int frame_really_changed = (f->buffers_changed ||
+                             f->clip_changed ||
+                             f->faces_changed    ||
+                             f->frame_changed    ||
+                             f->modeline_changed ||
+                             f->subwindows_changed ||
+                             f->windows_changed ||
+                             f->windows_structure_changed);
 
   XSETWINDOW (window, w);
 
@@ -1225,7 +1246,7 @@ redisplay_output_layout (struct window *w,
 
   /* Highly dodgy optimization. We want to only output the whole
      layout if we really have to. */
-  if (frame_changed || IMAGE_INSTANCE_DIRTYP (p))
+  if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (p))
     {
       /* First clear the area we are drawing into. This is the easiest
         thing to do since we have many gaps that we have to make sure are
@@ -1327,7 +1348,7 @@ redisplay_output_layout (struct window *w,
                       generalisation.*/
                    if (redisplay_normalize_glyph_area (&cdb, &cdga) 
                        &&  
-                       (frame_changed || IMAGE_INSTANCE_DIRTYP (childii)))
+                       (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)))
                      {
                        struct display_line dl; /* this is fake */
                        Lisp_Object string =
@@ -1361,14 +1382,14 @@ redisplay_output_layout (struct window *w,
                  
                case IMAGE_MONO_PIXMAP:
                case IMAGE_COLOR_PIXMAP:
-                 if (frame_changed || IMAGE_INSTANCE_DIRTYP (childii))
+                 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))
                    redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
                                             0, 0, 0, 0);
                  break;
              
                case IMAGE_WIDGET:
                case IMAGE_SUBWINDOW:
-                 if (frame_changed || IMAGE_INSTANCE_DIRTYP (childii))
+                 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))
                    redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
                                                0, 0, 0);
                  break;