Changeset 129e609 for perlglue.xs


Ignore:
Timestamp:
Dec 6, 2009, 8:08:24 PM (14 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
  • perlglue.xs

    ra01ed7c r129e609  
    326326all_filters()
    327327        PREINIT:
    328                 const owl_list *fl;
    329         CODE:
    330         {
    331                 fl = owl_global_get_filterlist(&g);
    332                 RETVAL = owl_new_av(fl, (SV*(*)(const void*))owl_filter_to_sv);
     328                owl_list fl;
     329        CODE:
     330        {
     331                owl_list_create(&fl);
     332                owl_dict_get_keys(&g.filters, &fl);
     333                RETVAL = owl_new_av(&fl, (SV*(*)(const void*))owl_new_sv);
    333334                sv_2mortal((SV*)RETVAL);
     335                owl_list_free_all(&fl, owl_free);
    334336        }
    335337        OUTPUT:
Note: See TracChangeset for help on using the changeset viewer.