User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
User:松/Drafts/Extension:AbuseFilter/Rules format (view source)
Revision as of 14:00, 13 August 2020
, 3 years ago→Performance
Line 593:
=== Performance ===
As noted in the table above, some of these variables can be very slow.While writing filters, remember that the condition limit is '''not''' a good metric of how heavy filters are.For instance, variables like <code>*_recent_contributors</code> or <code>*_links</code> always need a DB query to be computed, while <code>*_pst</code> variables will have to perform parsing of the text, which again is a heavy operation; all these variables should be used very, very carefully.For instance, on Italian Wikipedia it's been observed that, with 135 active filters and an average of 450 used conditions, filters execution time was around 500ms, with peaks reaching 15 seconds.Removing the <code>added_links</code> variable from a single filter, and halving the cases when another filter would use <code>added_lines_pst</code> brought the average execution time to 50ms.More specifically:
*Use <code>_links</code> variables when you need high accuracy and checking for "http://..." in other variables (for instance, <code>added_lines</code>) could lead to heavy malfunctioning;
*
*In general, when dealing with these variables, it's always much better to consume further conditions but avoid computing heavy stuff.In order to achieve this, always put heavy variables as last conditions.
|