Am 2022-05-19 11:53, schrieb bugzilla-dae...@spamassassin.apache.org:
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7987

--- Comment #28 from Henrik Krohns <apa...@hege.li> ---
A quick cleanup to tidy things:

- Use rule_ready() everywhere instead of direct tests_already_hit modify

Is this really necessary? It introduces thousands of additional subroutine calls.

- Simple tracking of meta dependency hits, run do_meta_tests only when needed - Do not run do_meta_tests on last priority, as finish_meta_tests will run
anyway

Committed revision 1901060.

It already reduces unnecessary do_meta_tests calls a lot.

Before:

do_meta_tests -1000 ready 2
do_meta_tests -950 ready 0
do_meta_tests -900 ready 0
do_meta_tests -100 ready 5
do_meta_tests -90 ready 0
do_meta_tests 0 ready 1234
do_meta_tests 500 ready 0

After:

do_meta_tests -950 ready 2
do_meta_tests -100 ready 5
do_meta_tests 0 ready 1234

Though in the grand total runtimes, it makes very little difference. It's hard to optimize things, as most metas will end up ready at priority 0 anyway.

Will look if there's further to improve, but I'm quite sceptical about the --$conf->{meta_dep_count} stuff, as it's really hard to guarantee that someone doesn't call rule_ready() multiple times, obviously then the counts will end up wrong and metas could be run prematurely. It's possible to track readiness perfectly with a hash from which you delete dependencies as they occur. I already tried something like that, but it gets so complex that it actually
increases runtimes.

No, this is absolutely not a problem. After going through the array with the dependencies the array should be deleted. Since it is only used once at the first time the rule is declared finished either by a call to got_hit or rule_ready, it can be deleted. Any further call of got_hit or rule_ready makes no change of the counters of the meta rules.

The algorithm you have now implemented looks too complicated and does not convince me.

Try my algorithm and do it even for the last priority. Then look which rules must be handled by finish_meta_tests and if your algorithm is needed for a better evaluation.

Michael

Reply via email to