From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: 33653@debbugs.gnu.org
Subject: bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables
Date: Thu, 06 Dec 2018 14:39:07 -0800 [thread overview]
Message-ID: <8736raz3ec.fsf@ericabrahamsen.net> (raw)
Here's the next thing: turning Gnus' obarrays-as-hash-tables into real
hash tables. Gnus currently stores information about groups by coercing
group names to unibyte, interning them in custom obarrays, and then
setting their symbol-value to whatever value needs to be stored. I think
all this was written before Emacs had actual hash tables.
I think real hash tables are better for a few reasons:
1. Hash table lookups seem to be marginally faster than obarray lookups,
2. It's "less weird" for contributors and bug hunters,
3. It allows us to reduces the amount of encoding/decoding going on:
group names can stay strings instead of being forced into symbols.
I've pushed a branch, scratch/gnus-hashtables, with two commits in it.
The first changes all the obarrays to hash tables. Apart from simply
replacing function calls, there were a few bumps.
1. Gnus uses `text-property-any' to find and compare group-name text
properties; I made a new `gnus-text-property-search' which behaves
similarly, but compares with equal.
2. Some of the "hash tables" were simply storing the value t, ie just
used for membership. I left these as hash tables, but I think in many
cases simple string-in-list membership tests would suffice.
3. The hash table in gnus-async.el didn't appear to be doing anything --
it seemed to be redundant with `gnus-async-article-alist'. I've
removed it, but it might need to be put back if I'm missing something.
4. The creation of `gnus-newsgroup-dependencies' was the most fiddly,
and I added tests for that. I'm not entirely convinced that
`gnus-thread-loop-p' behaves the way it's meant to, it appears to
only check for direct loops between parent and child, not parent and
descendant.
5. The old return value of (gnus-gethash <group-name>
gnus-newsrc-hashtb) was kind of a slice into `gnus-newsrc-alist': it
behaved a bit like `member', but also included the group *before* the
group you wanted, as well as all those after, so you could traverse
the list in either direction. It now no longer preserves the order of
`gnus-newsrc-alist' (this ordering wasn't actually used in many
places), and instead there's a new variable `gnus-group-list' which
records the proper sort order of the groups.
I feel fairly confident that all this is working okay. The second commit
I do *not* feel very confident about, and it's more of a "let's see how
things break" attempt. In theory, we should now be able to limit group
name encoding/decoding to the boundaries of Gnus -- reading/writing
active files, and talking to servers. Within Gnus, the group names can
remain decoded strings.
In the second commit I've just gone in and pulled out all the decoding I
can find, changed all the 'raw-text encoding options to 'undecided, and
deleted the `mm-disable-multibyte's. I have no confidence that I've
covered all the bases, though I have been using this branch for a couple
of weeks, with nnml, nnmaildir, and nnimap groups with multibyte names,
and so far nothing has broken. I'm less confident about nntp.
I'll continue working on this, and I hope I can get some feedback here,
particularly on the second commit.
Thanks, Eric
next reply other threads:[~2018-12-06 22:39 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 22:39 Eric Abrahamsen [this message]
2018-12-06 22:46 ` bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables Eric Abrahamsen
[not found] ` <m35zvzq34a.fsf@gnus.org>
2018-12-11 23:30 ` Eric Abrahamsen
2019-02-05 2:05 ` Eric Abrahamsen
2019-03-22 0:09 ` Eric Abrahamsen
2019-03-22 9:20 ` Robert Pluim
2019-03-22 17:21 ` Eric Abrahamsen
2019-03-22 19:54 ` Eric Abrahamsen
2019-03-22 21:07 ` Eli Zaretskii
2019-03-22 22:10 ` Eric Abrahamsen
2019-03-23 14:52 ` Andy Moreton
2019-03-23 16:14 ` Eric Abrahamsen
2019-03-26 18:28 ` Andy Moreton
2019-03-26 19:49 ` Eric Abrahamsen
2019-03-22 22:40 ` Glenn Morris
2019-03-22 22:51 ` Eric Abrahamsen
2019-03-23 6:46 ` Eli Zaretskii
2019-03-24 22:29 ` Bastien
2019-03-24 23:40 ` Eric Abrahamsen
2019-03-30 12:09 ` Deus Max
2019-03-31 23:27 ` Eric Abrahamsen
2019-04-01 22:39 ` Deus Max
2019-04-02 5:23 ` Eric Abrahamsen
2019-03-25 2:14 ` Katsumi Yamaoka
2019-03-25 2:35 ` Eric Abrahamsen
2019-03-25 14:45 ` Andy Moreton
2019-03-25 17:35 ` Eric Abrahamsen
2019-03-25 17:51 ` Robert Pluim
2019-03-25 18:17 ` Basil L. Contovounesios
2019-03-25 19:04 ` Bastien
2019-03-25 20:15 ` Andy Moreton
2019-03-26 19:58 ` Eric Abrahamsen
2019-03-26 21:44 ` Eric Abrahamsen
2019-03-27 4:54 ` Katsumi Yamaoka
2019-03-27 18:47 ` Eric Abrahamsen
2019-03-27 21:27 ` Eric Abrahamsen
2019-03-27 22:10 ` Eric Abrahamsen
2019-03-31 22:55 ` Eric Abrahamsen
2019-04-01 20:18 ` Adam Sjøgren
2019-04-01 20:57 ` Eric Abrahamsen
2019-04-02 16:43 ` Adam Sjøgren
2019-04-03 22:16 ` Katsumi Yamaoka
2019-04-03 22:36 ` Eric Abrahamsen
2019-04-05 4:25 ` Katsumi Yamaoka
2019-04-05 6:44 ` Katsumi Yamaoka
2019-04-05 11:02 ` Basil L. Contovounesios
2019-04-08 1:47 ` Katsumi Yamaoka
2019-04-05 20:18 ` Eric Abrahamsen
2019-04-08 1:58 ` Katsumi Yamaoka
2019-04-08 4:31 ` Katsumi Yamaoka
2019-04-11 21:29 ` Basil L. Contovounesios
2019-04-11 23:56 ` Katsumi Yamaoka
2019-04-12 11:05 ` Basil L. Contovounesios
2019-06-22 13:11 ` Lars Ingebrigtsen
2019-04-05 11:01 ` Basil L. Contovounesios
2019-04-08 8:13 ` Katsumi Yamaoka
2019-04-08 8:57 ` Andreas Schwab
2019-04-09 0:55 ` Katsumi Yamaoka
2019-04-08 18:31 ` Eric Abrahamsen
2019-04-09 0:55 ` Katsumi Yamaoka
2019-04-09 2:01 ` Eric Abrahamsen
2019-04-09 4:18 ` Katsumi Yamaoka
2019-04-09 4:30 ` Eric Abrahamsen
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=8736raz3ec.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=33653@debbugs.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.