diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2010-02-17 21:53:07 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2010-02-17 22:11:42 +0100 |
commit | dfd48621d1a54f2beb461fe3847fc4b2a535675e (patch) | |
tree | 7b6dbfb41496f6b3e3986b92ab0810246ae45b9c /filter/filter.c | |
parent | 14f6aca48037a0653e6bcfa27a4da48e8f962198 (diff) | |
download | bird-dfd48621d1a54f2beb461fe3847fc4b2a535675e.tar bird-dfd48621d1a54f2beb461fe3847fc4b2a535675e.zip |
Replaces the algorithm for building balanced trees.
Changes the time complexity of the algorithm from O(n^2) to O(n*log(n)).
This speeds up loading of huge DEC-IX config from 128 s to 15 s. It also
makes the code significantly simpler.
Diffstat (limited to 'filter/filter.c')
-rw-r--r-- | filter/filter.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/filter/filter.c b/filter/filter.c index b88039f..ec155ee 100644 --- a/filter/filter.c +++ b/filter/filter.c @@ -164,6 +164,11 @@ val_compare(struct f_val v1, struct f_val v2) } } +int +tree_compare(const void *p1, const void *p2) +{ + return val_compare((* (struct f_tree **) p1)->from, (* (struct f_tree **) p2)->from); +} void f_prefix_get_bounds(struct f_prefix *px, int *l, int *h) |