diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-25 12:25:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-25 13:30:42 +0100 |
commit | a22588464ce3dfb1aefed8cd8542700f21efaeb2 (patch) | |
tree | 15cf4d74815f919b169947a1f989145ece0fe62a | |
parent | 733c60e01a4c7de619bc5e77bd89c9525b38b31e (diff) | |
download | rspamd-a22588464ce3dfb1aefed8cd8542700f21efaeb2.tar.gz rspamd-a22588464ce3dfb1aefed8cd8542700f21efaeb2.zip |
[Minor] Remove last elt optimization for now
-rw-r--r-- | src/libserver/symbols_cache.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 960171e1c..17fcb192d 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -181,7 +181,6 @@ struct cache_savepoint { gdouble lim; struct rspamd_symcache_item *cur_item; guint items_inflight; - guint last_elt; struct symbols_cache_order *order; }; @@ -1666,7 +1665,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, saved_priority = G_MININT; all_done = TRUE; - for (i = checkpoint->last_elt; i < (gint)cache->prefilters->len; i ++) { + for (i = 0; i < (gint)cache->prefilters->len; i ++) { item = g_ptr_array_index (cache->prefilters, i); if (RSPAMD_TASK_IS_SKIPPED (task)) { @@ -1687,7 +1686,6 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, * priority filters to be processed */ checkpoint->pass = RSPAMD_CACHE_PASS_PREFILTERS; - checkpoint->last_elt = i; return TRUE; } @@ -1701,12 +1699,9 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, if (all_done || stage == RSPAMD_TASK_STAGE_FILTERS) { checkpoint->pass = RSPAMD_CACHE_PASS_FILTERS; - checkpoint->last_elt = 0; } if (stage == RSPAMD_TASK_STAGE_FILTERS) { - checkpoint->last_elt = 0; - return rspamd_symbols_cache_process_symbols (task, cache, stage); } @@ -1720,7 +1715,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, */ all_done = TRUE; - for (i = checkpoint->last_elt; i < (gint)checkpoint->version; i ++) { + for (i = 0; i < (gint)checkpoint->version; i ++) { if (RSPAMD_TASK_IS_SKIPPED (task)) { return TRUE; } @@ -1741,10 +1736,6 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, "resolved", item->id, item->symbol); - if (checkpoint->last_elt == 0) { - checkpoint->last_elt = i; - } - continue; } @@ -1766,11 +1757,9 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, if (all_done || stage == RSPAMD_TASK_STAGE_POST_FILTERS) { checkpoint->pass = RSPAMD_CACHE_PASS_POSTFILTERS; - checkpoint->last_elt = 0; } if (stage == RSPAMD_TASK_STAGE_POST_FILTERS) { - checkpoint->last_elt = 0; return rspamd_symbols_cache_process_symbols (task, cache, stage); } @@ -1782,7 +1771,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, saved_priority = G_MININT; all_done = TRUE; - for (i = checkpoint->last_elt; i < (gint)cache->postfilters->len; i ++) { + for (i = 0; i < (gint)cache->postfilters->len; i ++) { if (RSPAMD_TASK_IS_SKIPPED (task)) { return TRUE; } @@ -1805,7 +1794,6 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, * priority filters to be processed */ checkpoint->pass = RSPAMD_CACHE_PASS_POSTFILTERS; - checkpoint->last_elt = i; return TRUE; } @@ -1818,18 +1806,14 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, if (all_done) { checkpoint->pass = RSPAMD_CACHE_PASS_IDEMPOTENT; - checkpoint->last_elt = 0; } if (checkpoint->items_inflight == 0 || stage == RSPAMD_TASK_STAGE_IDEMPOTENT) { checkpoint->pass = RSPAMD_CACHE_PASS_IDEMPOTENT; - checkpoint->last_elt = 0; } if (stage == RSPAMD_TASK_STAGE_IDEMPOTENT) { - checkpoint->last_elt = 0; - return rspamd_symbols_cache_process_symbols (task, cache, stage); } @@ -1839,7 +1823,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, /* Check for postfilters */ saved_priority = G_MININT; - for (i = checkpoint->last_elt; i < (gint)cache->idempotent->len; i ++) { + for (i = 0; i < (gint)cache->idempotent->len; i ++) { item = g_ptr_array_index (cache->idempotent, i); if (!CHECK_START_BIT (checkpoint, item) && @@ -1856,7 +1840,6 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, * priority filters to be processed */ checkpoint->pass = RSPAMD_CACHE_PASS_IDEMPOTENT; - checkpoint->last_elt = i; return TRUE; } |