Commit ba35960
committed
Avoid closure allocation in safeFilter / implodeFiltered
Pass a static array callable to array_filter instead of allocating a
fresh closure on every call. Required promoting safeFilterFunc from
protected to public so array_filter (external scope) can resolve it.
Measured on cloudinary_php URL workload (12-run alternating A/B,
5000 iterations each):
(string) new Image() -8.2% (26.67 -> 24.49 us/op)
$image->toUrl() -15.5% (23.08 -> 19.50 us/op)1 parent 564e06d commit ba35960
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
| |||
188 | 186 | | |
189 | 187 | | |
190 | 188 | | |
191 | | - | |
| 189 | + | |
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
| |||
224 | 222 | | |
225 | 223 | | |
226 | 224 | | |
227 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
0 commit comments