Commit f4ca886
committed
minor symfony#61107 optimize
This PR was squashed before being merged into the 7.4 branch.
Discussion
----------
optimize `in_array` calls
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Issues |
| License | MIT
`in_array` calls are optimized by php when fully-qualified and using a static array and the strict param:
```php
namespace Foo;
$a = [1, 2, 3];
\in_array($b, $a, true); // not optimized because variable array
\in_array($b, [1, 2, 3]); // not optimized because missing strict param
in_array($b, [1, 2, 3], true); // not optimized because no leading `\` or import
\in_array($b, [1, 2, 3], true); // optimized
```
https://3v4l.org/FjKJ0/vld
You can see in the "VLD" tab that lines 6, 8 and 10 use the function call opcodes (`INIT_FCALL` or `INIT_NS_FCALL_BY_NAME`) while line 12 uses the optimized `IN_ARRAY` opcode without a function call.
In this pull request I changed only those places where the change enables the optimized opcode (by adding the strict param or inlining the array).
Commits
-------
33157f7 optimize `in_array` callsin_array calls (gharlan)File tree
70 files changed
+89
-120
lines changed- src/Symfony
- Bridge/Doctrine
- DependencyInjection
- Form
- ChoiceList
- Bundle
- FrameworkBundle
- Command
- DependencyInjection
- TwigBundle/Tests/DependencyInjection
- Component
- AssetMapper/ImportMap
- BrowserKit
- Console
- Helper
- Tests/Helper
- CssSelector/Parser
- Handler
- DependencyInjection
- Dumper
- Loader
- DomCrawler
- Field
- ErrorHandler
- Finder/Comparator
- Form/Extension/Validator
- HttpClient
- HttpFoundation
- HttpKernel
- EventListener
- HttpCache
- Tests/HttpCache
- Lock/Store
- Mailer/Bridge
- AhaSend/RemoteEvent
- Amazon/Transport
- Brevo/Transport
- MailPace/Transport
- Mailchimp/Transport
- Mailgun/Transport
- Mailjet/Transport
- Postmark/Transport
- Resend/Transport
- Scaleway/Transport
- Sendgrid/Transport
- Sweego/Transport
- Messenger/Bridge
- Amqp/Transport
- Redis/Transport
- Notifier/Bridge
- Matrix
- Ntfy
- Sevenio
- Sms77
- PropertyInfo/Extractor
- Routing/Loader
- Security/Core/Tests/Authorization/Voter
- Serializer
- Encoder
- Tests/Normalizer
- String
- Translation/Command
- TypeInfo/Type
- Validator/Constraints
- Yaml
- Command
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
70 files changed
+89
-120
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2563 | 2563 | | |
2564 | 2564 | | |
2565 | 2565 | | |
2566 | | - | |
| 2566 | + | |
2567 | 2567 | | |
2568 | 2568 | | |
2569 | 2569 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2053 | 2053 | | |
2054 | 2054 | | |
2055 | 2055 | | |
2056 | | - | |
| 2056 | + | |
2057 | 2057 | | |
2058 | 2058 | | |
2059 | 2059 | | |
| |||
2935 | 2935 | | |
2936 | 2936 | | |
2937 | 2937 | | |
2938 | | - | |
| 2938 | + | |
2939 | 2939 | | |
2940 | 2940 | | |
2941 | 2941 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
0 commit comments