Repository navigation
Commit bcfd1ce
authored
Massive Performance Optimization and bug fixes (#137)
* Introduce targeted optimization for bottlenecks found via profiler
* Optimized ArrayShapeValidator
* Enhance RuntimeTypeChecker and ParamChecker with new configuration options and optimizations
* Add /benchmark/ directory to .gitignore
* Enhance type evaluation by adding trusted variable types to evaluators and static type checks to elimanate return type checking
* Add fast-path handling for common scalar identifiers in ParamChecker to improve performance
* Enhance RuntimeTypeChecker with additional parameter check constants and optimize validation logic
* Refactor MemberAssignChecker and RuntimeTypeChecker for improved type validation and caching
- Introduced new caching mechanisms in MemberAssignChecker for property mutation plans and substituted element contracts.
- Enhanced type validation logic in MemberAssignChecker to utilize RuntimeTypeChecker for inline properties and array validation.
- Updated RuntimeTypeChecker to support fast-path checks for generic return types and improved handling of inline properties.
- Refactored TemplateManager to include compiled binding plan caches for generic types, optimizing template binding processes.
- Added support for object generics in GenericValidator, ensuring proper validation of object types.
- Enhanced TypeValidatorRegistry to streamline type validation logic for identifiers.
- Added tests for handling PHP 8.1+ first-class callable syntax and parameter overwriting scenarios in ParameterTypeTrackingEliminationTest.
* Enhance MemberAssignChecker with improved contract validation and generics performance
* Refactor type substitution and resolution in TemplateSubstitutor and SpecialTypeResolver
- Improved type substitution logic to avoid unnecessary object creation when types remain unchanged in TemplateSubstitutor.
- Enhanced the resolveWithContext method in SpecialTypeResolver to streamline type resolution with context, reducing redundancy.
- Introduced caching mechanisms in CallableWrapper to optimize callable parameter type resolution and reduce repeated parsing.
- Simplified the execution of simple scope plans in RuntimeTypeChecker for better performance and readability.
- Added reset functionality for CallableWrapper to clear caches effectively.
* Enhance type checking and caching mechanisms in ConditionalChecker, GeneratorChecker, MemberAssignChecker, TemplateManager, RuntimeTypeChecker, and IterableWrapper for improved performance and reliability
* Massively improve performance in Various internal components
* Enhance type annotations across various components for improved type safety and clarity
* Enhance TemplateManager with additional caching mechanisms for generic type bindings and improve property binding propagation
* Enhance ContractVisitor and EliminationSafetyPolicy to support traits, improve FunctionContractInjector with elimination checks, and add property dimension assignment checks in RuntimeTypeChecker
* Enhance ParamChecker and TemplateManager with improved type handling and caching mechanisms, and add ClosureParameterTemplateOverwritingTest to ensure template preservation in closures
* Enhance ParamChecker, ReturnChecker, TemplateManager, RuntimeTypeChecker, and GenericValidator with improved caching mechanisms, refined template handling, and optimized validation logic for better performance and type safety
* Refactor type validation logic and enhance class-string handling
- Changed the visibility of `validClassStringCache` in ClassNameValidator to public for better accessibility.
- Updated CollectionElementValidator to utilize RuntimeTypeChecker for hybrid validation checks instead of Config.
- Added support for new types in CollectionElementValidator: 'object', 'array-key', and 'class-string' with appropriate validation logic.
- Enhanced GenericValidator to include detailed array plan handling and improved validation for key-value type arrays.
- Updated UnionValidator to streamline type checks and added support for mixed types, arrays, and iterables.
- Improved type validation logic in TypeValidatorRegistry to include class-string checks.
- Fixed test case to correctly reference TypeError class.
* Enhance ContractVisitor and NodeBuilder to support class constant checks for protected and private constants, and add tests for validation and transformation of constant visibility
* Refactor ParamChecker and TemplateManager by improving template binding logic and removing unused methods for cleaner code
* Add tests for cross-namespace imported type alias resolution and related edge cases
* Refactor CRLF line-drift test to update parameter type from non-empty-string to string for consistency
* Enhance SpecialTypeResolver to support autoload parameter in type resolution methods and update CRLF line-drift test for improved readability
* Refactor CollectionElementValidator and GenericValidator to streamline type validation logic and remove unused SpecialTypeResolver references
* Refactor RuntimeTypeChecker to enhance type validation logic and improve cache management1 parent 72e4979 commit bcfd1ce
48 files changed
Lines changed: 9144 additions & 1239 deletions
File tree
- src/Internal
- Ast
- Elimination
- Evaluator
- Checker
- Docblock
- Generics
- Io
- Resolver
- Util
- Validator
- Wrapper
- tests
- Fixtures/ImportedAlias
- Child
- Enums
- Repo
- Types
- Internal
- Ast
- Elimination
- Util
- TypeChecking
- ArraysAndShapes
- Boundaries
- Generics
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
| |||
904 | 909 | | |
905 | 910 | | |
906 | 911 | | |
| 912 | + | |
907 | 913 | | |
908 | 914 | | |
909 | 915 | | |
| |||
975 | 981 | | |
976 | 982 | | |
977 | 983 | | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
978 | 987 | | |
979 | 988 | | |
980 | 989 | | |
| |||
1036 | 1045 | | |
1037 | 1046 | | |
1038 | 1047 | | |
| 1048 | + | |
1039 | 1049 | | |
1040 | 1050 | | |
1041 | 1051 | | |
| |||
1463 | 1473 | | |
1464 | 1474 | | |
1465 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
1466 | 1480 | | |
1467 | 1481 | | |
1468 | 1482 | | |
| |||
1471 | 1485 | | |
1472 | 1486 | | |
1473 | 1487 | | |
1474 | | - | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
1475 | 1519 | | |
1476 | 1520 | | |
1477 | 1521 | | |
| |||
1899 | 1943 | | |
1900 | 1944 | | |
1901 | 1945 | | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
1902 | 1955 | | |
1903 | 1956 | | |
1904 | 1957 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 55 | + | |
61 | 56 | | |
62 | | - | |
63 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | | - | |
| 74 | + | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
| 82 | + | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
89 | 88 | | |
90 | 89 | | |
91 | | - | |
92 | | - | |
93 | 90 | | |
94 | 91 | | |
95 | 92 | | |
| |||
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 135 | + | |
141 | 136 | | |
142 | | - | |
143 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
148 | | - | |
| 147 | + | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
152 | | - | |
| 151 | + | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | | - | |
| 155 | + | |
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
160 | | - | |
| 159 | + | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
164 | | - | |
| 163 | + | |
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | 173 | | |
175 | | - | |
176 | | - | |
| 174 | + | |
177 | 175 | | |
178 | | - | |
179 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
198 | | - | |
| 201 | + | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
| |||
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
207 | | - | |
208 | | - | |
| 210 | + | |
209 | 211 | | |
210 | | - | |
211 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| |||
232 | 240 | | |
233 | 241 | | |
234 | 242 | | |
235 | | - | |
| 243 | + | |
236 | 244 | | |
237 | 245 | | |
238 | 246 | | |
239 | | - | |
| 247 | + | |
240 | 248 | | |
241 | 249 | | |
242 | 250 | | |
| |||
245 | 253 | | |
246 | 254 | | |
247 | 255 | | |
248 | | - | |
249 | | - | |
250 | | - | |
| 256 | + | |
251 | 257 | | |
252 | | - | |
253 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
254 | 264 | | |
255 | 265 | | |
256 | 266 | | |
| |||
304 | 314 | | |
305 | 315 | | |
306 | 316 | | |
307 | | - | |
| 317 | + | |
308 | 318 | | |
309 | 319 | | |
310 | 320 | | |
| |||
321 | 331 | | |
322 | 332 | | |
323 | 333 | | |
324 | | - | |
| 334 | + | |
325 | 335 | | |
326 | 336 | | |
327 | 337 | | |
328 | 338 | | |
329 | | - | |
| 339 | + | |
330 | 340 | | |
331 | 341 | | |
332 | 342 | | |
| |||
0 commit comments