Changeset 129e609 for mainwin.c


Ignore:
Timestamp:
Dec 6, 2009, 8:08:24 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
bafbba1
Parents:
2c48db8
git-author:
Nelson Elhage <nelhage@mit.edu> (12/02/09 22:09:13)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/06/09 20:08:24)
Message:
Use a owl_dict to store the list of filters.

Cathy Zhang reported that narrowing to filters that reference other
filters is significantly slower than narrowing to filters that
don't. The culprit is almost certainly the linear lookup of filters by
name, which we currently do on each filter evaluation.

Switch to using an owl_dict, which will now do a binary search over
the filter list. We could potentially get this even faster by caching
the owl_filter itself inside the owl_filterelement, and invalidating
it somehow on filter redefinition, but we can save that sort of
cleverness for later, if necessary.

We also store the filters in a linked list, in order to preserve the
ability to traverse them in order, for ":show filters" and for
coloring.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mainwin.c

    rf63a681 r129e609  
    1010{
    1111  owl_message *m;
    12   int i, p, q, lines, isfull, viewsize;
     12  int i, lines, isfull, viewsize;
    1313  int x, y, savey, recwinlines, start;
    1414  int topmsg, curmsg, markedmsgid, fgcolor, bgcolor;
    1515  WINDOW *recwin;
    1616  const owl_view *v;
    17   const owl_list *filtlist;
     17  GList *fl;
    1818  const owl_filter *f;
    1919
     
    7373    fgcolor=OWL_COLOR_DEFAULT;
    7474    bgcolor=OWL_COLOR_DEFAULT;
    75     filtlist=owl_global_get_filterlist(&g);
    76     q=owl_list_get_size(filtlist);
    77     for (p=0; p<q; p++) {
    78       f=owl_list_get_element(filtlist, p);
     75    for (fl = g.filterlist; fl; fl = g_list_next(fl)) {
     76      f = fl->data;
    7977      if ((owl_filter_get_fgcolor(f)!=OWL_COLOR_DEFAULT) ||
    8078          (owl_filter_get_bgcolor(f)!=OWL_COLOR_DEFAULT)) {
Note: See TracChangeset for help on using the changeset viewer.