3 ms·
Short-circuit evaluation. The structure of the flow looks like a ladder. The (x86) assembly produced would look something like this: cmp al, 128 jae f
by userbinator 11y ago
Short-circuit evaluation.
The structure of the flow looks like a ladder. The (x86) assembly produced would look something like this:
cmp al, 128
jae false
cmp al, 32
jbe false
cmp al, 9
jz false
cmp al, '"'
jz false
cmp al, '('
jz false
cmp al, ')'
jz false
...
Edit: yes, I know 9 is less than 32 and would've been caught by the condition before it; I was just "mentally compiling" the expression directly without thinking much about optimising it.
- chrisdew 11y agoThanks for that. Would adding extra brackets (turning it into a tree structure) allow the CPU to use multiple ALUs to evaluate branches in parallel? ( ( ( c < 128 && c > 32 ) && ( c != b'\t' && c != b'"' ) ) && ( ( c != b',' && c != b'/' ) && ( !(c > 57 && c < 65) && !(c > 90 && c < 94) ) && ( c != b'{' && c != b'}' ) ) )