emacs-devel
[Top][All Lists]
Advanced

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

Re: Choosing a data structure for cache of multiple fake cursors.


From: Eli Zaretskii
Subject: Re: Choosing a data structure for cache of multiple fake cursors.
Date: Tue, 25 Dec 2018 15:36:26 +0200

> Date: Mon, 24 Dec 2018 22:18:12 -0800
> From: Keith David Bershatsky <address@hidden>
> 
> 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].

You didn't describe what each element means.

> 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)?

If the number of elements is fixed, then a vector would be more
convenient, but other than that, I don't see why it would be a poor
choice to use a list.  We access and modify lists (and other Lisp
objects) from C code all the time, to say nothing of the fact that
these objects and the primitive operations on them are implemented in
C to begin with.



reply via email to

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