[php-src] Issue #10729: `array_keys` with const input seems to be not optimized
| From: | mvorisek | Date: | Tue, 28 Feb 2023 12:10:20 +0000 |
| Subject: | [php-src] Issue #10729: `array_keys` with const input seems to be not optimized | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243819@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10729
Author: mvorisek
### Description
The following code:
https://3v4l.org/Btrh0/rfc#vgit.master_jit
Resulted in this output:
```
float(0.1064751148223877)
float(0.07117080688476562)
float(0.3041820526123047)
```
But I expected this output instead:
```
float(0.1064751148223877)
float(0.07117080688476562)
float(0.07117080688476562)
```
I expect
array_keys to be optimized to const with const input. 2nd and 3rn time must be
about the same.
I also expect in_array to be optimized to use hash based 0(1) lookup when the array is
const.
### PHP Version
any
### Operating System
any