Repository navigation
Commit f041da5
committed
Memoize CallableType::describe() per verbosity level
ObjectType::isSuperTypeOf() keys its cache by describe(VerbosityLevel::cache())
of the other type, so a union of classes with a callable(...) describes the
same CallableType once per class member. Since describe() prints through
TypeNodeDescriber (a PHPDoc node traversal swapping name nodes, then the
printer), that became the bulk of the time for such unions: a file with
1,000 calls of a function taking T|A1|...|A10|callable(A1, A2, A3, A4): T
described 140,000 callables, 7,000 of them distinct.
The description is now cached per level, as ClosureType, UnionType and
IntersectionType already do. The turbo extension mirrors the cache.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1b250-3c08-762d-acb0-9cdf8e7a210e1 parent 4890a6f commit f041da5
4 files changed
Lines changed: 1049 additions & 6 deletions
File tree
- src/Type
- tests/bench/data
- turbo-ext/src
- generated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
335 | 338 | | |
336 | 339 | | |
337 | 340 | | |
338 | | - | |
| 341 | + | |
339 | 342 | | |
340 | 343 | | |
341 | 344 | | |
| |||
0 commit comments