unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* bool-vector implementation in the Emacs core
@ 2004-01-21 16:52 Ted Zlatanov
  2004-01-21 17:06 ` Paul Jarc
  2004-01-23  0:16 ` Kim F. Storm
  0 siblings, 2 replies; 13+ messages in thread
From: Ted Zlatanov @ 2004-01-21 16:52 UTC (permalink / raw)


It looks like the current Emacs bool-vector implementation uses true
uncompressed bit vectors (bit strings).  For applications such as
Gnus, where bit ranges can be large, this is unnecessary.  Can there
be either an alternate implementation (bool-inversion-list) or an
alternate internal storage of bool-vectors in the Emacs C core?

I'm thinking, specifically, of either the Gnus ranges or inversion
lists.  Gnus ranges are like this:

(1 (6 . 8) 1000 (1500 . 1600) 2000)

Inversion lists store the number where the toggle occurs, so the
above example would be:

(1 2 6 8 1000 1001 1500 1600 2000 2001) [ or the equivalent vector ]

as an inversion list.  Inversion lists are faster for searching and
most other set operations (I heard about them in the context of
Unicode programming), while ranges are more intuitive to a human
reader.  I prefer inversion lists, personally - if something should
go in the core, it better be fast.  It won't be as fast as bit
strings, of course, but the difference in memory consumption should
be significant.

We're talking about implementations of ranges in the Gnus developer
list right now, and our implementations of ranges is written in
Lisp.  I can implement inversion lists in Lisp as well, but ranges
are such an essential Gnus piece that it seems like seeking core
support for them would be a good idea.

When dealing with vectors, we can preallocate a fixed number of slots
at the end of the vector to allow for growth or shrinkage of the
inversion list.  The empty slots can be contain the repetition of
the last value, or 0 as an out-of-band value.  I think a list-based
implementation is slightly better, though.

I did a search on this topic, but could not find anything.  I hope my
proposal is of interest to people other than Gnus developers (Unicode
coders, for instance).

Thanks
Ted

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-01-27  1:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 16:52 bool-vector implementation in the Emacs core Ted Zlatanov
2004-01-21 17:06 ` Paul Jarc
2004-01-21 18:35   ` Ted Zlatanov
2004-01-23  0:16 ` Kim F. Storm
2004-01-23  0:37   ` Kenichi Handa
2004-01-23  2:19     ` Stefan Monnier
2004-01-23 20:26     ` Ted Zlatanov
2004-01-24 21:40       ` Richard Stallman
2004-01-25  2:59         ` Ted Zlatanov
2004-01-26 19:23           ` Richard Stallman
2004-01-27  1:32             ` Kim F. Storm
2004-01-23 20:18   ` Ted Zlatanov
2004-01-24  2:11     ` Kim F. Storm

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