unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Alex Gramiak <agrambot@gmail.com>
Cc: eliz@gnu.org, dancol@dancol.org, emacs-devel@gnu.org
Subject: Re: NS port: How to debug excessive garbage collection?
Date: Mon, 15 Apr 2019 19:57:48 -0700	[thread overview]
Message-ID: <m2d0lmk66r.wl%esq@lawlist.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]

I am working on implementing the suggestion of Alex to use structures to store the data for each fake cursor on a per window basis, instead of the prior method that created a Lisp_Object of cons cells (causing the excessive garbage collection issue).

It seemed to me that the implementation of creating the vector to store glyph rows looked somewhat similar to what we want to do here.  I attempted to borrow a portion of that vector glyph row implementation in the attached working example that applies to the master branch as of 04/08/2019 (a038df77de7b1aa2d73a6478493b8838b59e4982).

I had hoped to keep the cache (w->mc_elts) alive for the duration that the fake cursors feature is active in a visible window.  However, the cache (w->mc_elts) disappears and becomes NULL.  In the attached example, whenever it is time to increase the size of the dynamic vector, I set the value of w->mc_elts[99].x to 99.  The value of -1 is used in the stderr printout whenever w->mc_elts is NULL.

How can I make the cache (w->mc_elts) persistent without automatically becoming NULL?

In the attached example, I launch Emacs after applying the patch and evaluate:  (setq crosshairs t)

w->mc_nelts (100) | w->mc_elts_allocated (100) | w->mc_elts[99].x (99)
w->mc_nelts (200) | w->mc_elts_allocated (200) | w->mc_elts[99].x (99)
w->mc_nelts (300) | w->mc_elts_allocated (300) | w->mc_elts[99].x (99)
w->mc_nelts (400) | w->mc_elts_allocated (450) | w->mc_elts[99].x (99)
w->mc_nelts (500) | w->mc_elts_allocated (675) | w->mc_elts[99].x (99)
w->mc_nelts (600) | w->mc_elts_allocated (675) | w->mc_elts[99].x (-1)
w->mc_nelts (700) | w->mc_elts_allocated (1012) | w->mc_elts[99].x (99)
w->mc_nelts (800) | w->mc_elts_allocated (1012) | w->mc_elts[99].x (-1)
w->mc_nelts (900) | w->mc_elts_allocated (1012) | w->mc_elts[99].x (-1)
w->mc_nelts (1000) | w->mc_elts_allocated (1012) | w->mc_elts[99].x (-1)
w->mc_nelts (1100) | w->mc_elts_allocated (1518) | w->mc_elts[99].x (99)
w->mc_nelts (1200) | w->mc_elts_allocated (1518) | w->mc_elts[99].x (-1)
w->mc_nelts (1300) | w->mc_elts_allocated (1518) | w->mc_elts[99].x (-1)
w->mc_nelts (1400) | w->mc_elts_allocated (1518) | w->mc_elts[99].x (-1)
w->mc_nelts (1500) | w->mc_elts_allocated (1518) | w->mc_elts[99].x (-1)
w->mc_nelts (1600) | w->mc_elts_allocated (2277) | w->mc_elts[99].x (99)


[-- Attachment #2: 2019_04_15__19_36_14_173.diff --]
[-- Type: application/diff, Size: 8668 bytes --]

             reply	other threads:[~2019-04-16  2:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  2:57 Keith David Bershatsky [this message]
2019-04-16  5:26 ` NS port: How to debug excessive garbage collection? Alex Gramiak
  -- strict thread matches above, loose matches on Subject: below --
2019-04-16  5:51 Keith David Bershatsky
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 18:07 Keith David Bershatsky
2019-04-13 21:41 ` Alex Gramiak
2019-04-14  3:47 ` Daniel Colascione
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2d0lmk66r.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=agrambot@gmail.com \
    --cc=dancol@dancol.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).