You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add specialized handler for checking if identical to string
This has a large performance benefit for the below snippet (0.64s vs 0.94s),
and a small benefit for `$alwaysStr == 'notnumeric'`/`$s = 'other'`
(for 1000 runs of test('test'))
- If the literal is non-numeric and the variable is a string,
`==` behaves identically to `===`, so reuse the opcode.
This is similar to what was suggested in #4900
- Avoiding types with __destruct or notices simplifies the specialized
implementation and avoids expensive exception handling.
- TMPVARCV doesn't support FREE_OP1() - use TMPVAR|CV instead.
```
function test(string $s) : int {
$total = 0;
for ($i = 0; $i < 100000; $i++) {
if ($s === "first") {
$total++;
$s = null;
}
}
return $total;
}
```
0 commit comments