emacs-devel
[Top][All Lists]
Advanced

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

Re: NS port: How to debug excessive garbage collection?


From: Alex Gramiak
Subject: Re: NS port: How to debug excessive garbage collection?
Date: Sat, 13 Apr 2019 15:41:22 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Keith David Bershatsky <address@hidden> writes:

> Thank you, Alex, for helping to diagnose the issue of excessive garbage
> collection. I observe the issue when building Emacs on an OSX machine using 
> the
> --with-ns flag. The issue may also occur on the w32 and X11 builds of Emacs, 
> but
> it is not noticeable to my naked eye. The NS build, on the other hand, permits
> me to see an appreciable pause for garbage collection every few keystrokes. 
> The
> garbage collection tests with *_consed that I performed today were on the NS
> port of Emacs.

If you haven't already, IMO it would do well to perform these tests on
w32 or X11 to see if there's any difference even if it's not noticeable.

> The usage of Ftruncate in the 04/08/2019 proof concept patch of fake cursors 
> occurs only in w32term.c and xterm.c.

Right, I didn't notice that the nsterm.c implementation was missing it.

> Perhaps there is a similar mistake I have made that would affect the NS build 
> of
> Emacs, or perhaps would affect all of the builds (NS/w32/X11).

Just to make sure, how about putting the debug_fg and the associated
ASET/make_float calls inside an if (debug_p) in mc_update_text_area?
It's probably not it, but it doesn't hurt to cross it off.

This might not help much, but I noticed this section:

+  enum face_id special_char_face_id =
+    lookup_named_face (w, f, intern ("+-special-character-face"), true);
+  struct face *special_char_face = FACE_FROM_ID (f, special_char_face_id);
+  Lisp_Object special_char_fg_color = 
special_char_face->lface[LFACE_FOREGROUND_INDEX];
+  Lisp_Object special_char_fg_vec = mc_color_vector_calc (w, 
special_char_fg_color);
+  if (glyph != NULL
+      && glyph->u.ch == 95
+      && cursor_type == HBAR_CURSOR)
+    foreground = special_char_fg_vec;

It would be better to place everything within the conditional here,
since mc_color_vector_calc calls make_float:

+  if (glyph != NULL
+      && glyph->u.ch == 95
+      && cursor_type == HBAR_CURSOR)
+    {
+      enum face_id special_char_face_id =
+        lookup_named_face (w, f, intern ("+-special-character-face"), true);
+      struct face *special_char_face = FACE_FROM_ID (f, special_char_face_id);
+      Lisp_Object special_char_fg_color = 
special_char_face->lface[LFACE_FOREGROUND_INDEX];
+      Lisp_Object special_char_fg_vec = mc_color_vector_calc (w, 
special_char_fg_color);     
+      foreground = special_char_fg_vec;
+    }

P.S.

I also noticed SSDATA (build_string ("string")) that I believe should
just be "string" (with the return type being const char *).

Also, the CHARACTERP (make_fixnum (arg)) could be:

  0 <= arg && arg <= MAX_CHAR

which is how other code in Emacs appears to check if a C int is a
character.



reply via email to

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