Changeset 129e609 for owl.c


Ignore:
Timestamp:
Dec 6, 2009, 8:08:24 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, 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
  • owl.c

    r6c81223 r129e609  
    176176
    177177  for (i = 0; filters[i].name != NULL; i++)
    178     owl_list_append_element(owl_global_get_filterlist(&g),
    179                             owl_filter_new_fromstring(filters[i].name,
    180                                                       filters[i].desc));
     178    owl_global_add_filter(&g, owl_filter_new_fromstring(filters[i].name,
     179                                                        filters[i].desc));
    181180}
    182181
Note: See TracChangeset for help on using the changeset viewer.