all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Gramiak <agrambot@gmail.com>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: NS port:  How to debug excessive garbage collection?
Date: Sat, 13 Apr 2019 15:41:22 -0600	[thread overview]
Message-ID: <87lg0dtwfx.fsf@gmail.com> (raw)
In-Reply-To: <m24l71hj7o.wl%esq@lawlist.com> (Keith David Bershatsky's message of "Sat, 13 Apr 2019 11:07:55 -0700")

Keith David Bershatsky <esq@lawlist.com> 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	other threads:[~2019-04-13 21:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-13 18:07 NS port: How to debug excessive garbage collection? Keith David Bershatsky
2019-04-13 21:41 ` Alex Gramiak [this message]
2019-04-14  3:47 ` Daniel Colascione
  -- strict thread matches above, loose matches on Subject: below --
2019-04-16  5:51 Keith David Bershatsky
2019-04-16  2:57 Keith David Bershatsky
2019-04-16  5:26 ` Alex Gramiak
2019-04-15  5:19 Keith David Bershatsky
2019-04-15  2:55 Keith David Bershatsky
2019-04-15  3:44 ` Alex Gramiak
2019-04-14 19:46 Keith David Bershatsky
2019-04-14 23:31 ` Alex Gramiak
2019-04-14  7:41 Keith David Bershatsky
2019-04-13 16:31 Keith David Bershatsky
2019-04-13 17:02 ` Alex Gramiak
2019-04-13  5:55 Keith David Bershatsky
2019-04-13  6:48 ` Eli Zaretskii
2019-04-11 23:04 Keith David Bershatsky
2019-04-12  9:30 ` Eli Zaretskii
2019-04-11  3:27 Keith David Bershatsky
2019-04-11 14:14 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lg0dtwfx.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.