-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reflecting same class trees leads to extremely high amount of repeated parsing/AST traversal and therefore overhead #417
Comments
Removing from the 3.0.0 milestone. This is a hard to crack problem, and 90%+ of the overhead comes from this bit: BetterReflection/src/SourceLocator/Ast/FindReflectionsInTree.php Lines 127 to 130 in f8b3fc6
Possible approaches are perform that iteration only once during parsing and memoizing (as part of the "located source" operations) but that's not in our current scope. |
To clarify further, as per #419:
|
I would like to use BetterReflection in the part of PHPUnit that finds the tests (instead of Implementing my own caching on a file level is rather trivial ... but it falls short when inheritance comes into play. Is this something you are considering for your caching? What I mean is tracking that the information |
I think this is largely solved by #461, which makes each lookup extremely fast, and found the root problem of most performance issues so far. Before that, each class lookup (including already found symbols) would lead to a |
Closing: this is indeed handled by #461. This is strictly related to #612 and #614 too. The problem itself is that each source locator has a "strategy" for finding symbols, and some locators are just "dumb", and should probably stay dumb. Implementing custom/smarter locators has been done in #461 (for composer-friendly projects), and changing the pre-existing ones is not necessary, and will only lead to potential regressions. |
To reproduce, something like this would probably suffice:
This is because the various internal components don't cache the reflections.
What we can do:
ClassReflector
and theFunctionReflector
keep an internal cache by default (not so nice)CachedReflector
that caches based on the requested identifier (not so easy due to delegation logic happening in theClassReflector
internals)The text was updated successfully, but these errors were encountered: