all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Choosing a data structure for cache of multiple fake cursors.
Date: Mon, 24 Dec 2018 22:18:12 -0800	[thread overview]
Message-ID: <m2h8f2ku3f.wl%esq@lawlist.com> (raw)

I am working on optimizing the drawing/erasing of multiple fake cursors in conjunction with the proposed implementation of feature requests #22873 (multiple fake cursors) and #17684 (crosshairs / visible fill-column).

The lines that need to potentially be updated can be extracted from update_window, which calls update_window_line, which calls update_text_area.  I have created modified versions of update_window_line / update_text_area and made a "dry run" that yields a list of lines that need to potentially be updated (before the updating actually occurs).  Let us assume for purposes of this example that the "dry run" tells us that we need to potentially update VPOS lines 5, 8 and 25.

The cache of multiple fake cursors is presently in the form of a Lisp_Object with 15 elements for each fake cursor.  From studying the Emacs code, it appears that a Lisp_Object may have been a poor choice for the cache data structure.  The reason I say that, is because now I am faced with the need to add/delete certain elements from the cache.

The elements of the cache are as follows:  x [int]; fx [frame x | int]; y [int]; fy [frame y | int]; hpos [int]; vpos [int]; h [height | int]; cursor_type [int]; cursor_width [int]; foreground [vector of 3 doubles]; background [vector of 3 doubles]; active_p [bool]; minimal_p [bool]; flavor [int]; posint [int].

In this example, we want to find all VPOS entries in the cache for 5, 8 and 25 and do two things:  (i) erase the fake cursors on the line; and, (2) recalculate/redraw the fake cursors on those lines based on the new layout.

Assuming that we are dealing with a potential of 200+ fake cursors on a visible window, what is the best data structure for performance and ease of add/removing elements (with 15 sub-elements)?

EXAMPLE:  Remove all lines from the cache that have a VPOS of 5, 8 and 25; and, add new entries to the cache with updated values for lines with a VPOS of 5, 8 and 25.

Thanks,

Keith



             reply	other threads:[~2018-12-25  6:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25  6:18 Keith David Bershatsky [this message]
2018-12-25 13:36 ` Choosing a data structure for cache of multiple fake cursors Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2018-12-25 19:21 Keith David Bershatsky

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=m2h8f2ku3f.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --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 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.