Support short-circuit bool ops
Closed, ResolvedPublic

Description

It will speed up lots of filters.


Version: unspecified
Severity: normal

Details

Reference
bz41693
bzimport raised the priority of this task from to Low.
bzimport set Reference to bz41693.
bzimport added a subscriber: Unknown Object (MLST).
liangent created this task.Nov 2 2012, 2:25 PM

Adding vvv to CC who is the author of AF parser.

vvv added a comment.Nov 4 2012, 2:00 AM

But they *do* short-circuit now, though not in a proper way.

(In reply to comment #2)

But they *do* short-circuit now, though not in a proper way.

I just see some filters only saying cond1 & cond2 where cond1 is very cheap and is false for most of edits (for example, user_name == 'FooBar') but cond2 is some more expensive consume more condition limit than expected (in short-circuited evaluation).

  • Bug 51784 has been marked as a duplicate of this bug. ***
He7d3r added a comment.EditedJul 22 2013, 10:06 AM

From T53784:

Currently, if I create a filter having the code

false & false & false & false & false

and then make an edit in any page, the filter's page will have a message saying "... it consumes 5 conditions of the condition limit."

There is no reason for it to consume the last 4 conditions, because the first one is already false.

Notice the behavior is a little better if the code is changed to

false & ( false & false & false & false )

because it will now consume just 2 conditions. Ideally, it should consume only 1 condition in both cases (see Short-circuit evaluation).

Dalba awarded a token.Jun 16 2015, 2:32 AM
Restricted Application added subscribers: Luke081515, Aklapper. · View Herald TranscriptAug 25 2015, 6:34 PM
Dalba added a subscriber: Dalba.Apr 9 2016, 10:23 AM
matmarex claimed this task.Apr 9 2016, 1:51 PM

Change 282475 had a related patch set uploaded (by Bartosz Dziewoński):
Improve ignoring short-circuited operations

https://gerrit.wikimedia.org/r/282475

matmarex raised the priority of this task from Low to High.Apr 9 2016, 2:26 PM

Change 282475 merged by jenkins-bot:
Improve ignoring short-circuited operations

https://gerrit.wikimedia.org/r/282475

matmarex set Security to None.
matmarex removed a subscriber: wikibugs-l-list.