unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables
@ 2018-12-06 22:39 Eric Abrahamsen
  2018-12-06 22:46 ` Eric Abrahamsen
  0 siblings, 1 reply; 63+ messages in thread
From: Eric Abrahamsen @ 2018-12-06 22:39 UTC (permalink / raw)
  To: 33653


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





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

end of thread, other threads:[~2019-06-22 13:11 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06 22:39 bug#33653: 27.0.50; Change Gnus obarrays-as-hash-tables into real hash tables Eric Abrahamsen
2018-12-06 22:46 ` 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

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