Memoize expensive calls to docComments.#458
Merged
ondrejmirtes merged 1 commit intophpstan:masterfrom Feb 26, 2021
Merged
Conversation
e23f3d0 to
f8aef12
Compare
ondrejmirtes
requested changes
Feb 26, 2021
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
Hi, this looks promising, thanks!
src/Reflection/ClassReflection.php
Outdated
Member
There was a problem hiding this comment.
I'd like to use a control structure (an if) here instead of just ?? on a single line. Like this:
if ($this->reflectionDocComment !== null) {
$docComment = $this->reflectionDocComment;
} else {
$docComment = $this->reflection->getDocComment();
$this->reflectionDocComment = $docComment;
}
src/Type/FileTypeMapper.php
Outdated
This reduces both RAM consumption & execution time.
f8aef12 to
0329dfd
Compare
Contributor
Author
|
@ondrejmirtes thanks for your feedback! Can you please look at it again? I don't understand why some tests fail. I'm not sure it is related to my changes... Can you please advise? |
Member
|
Master is broken, it's not your fault 😊 |
Member
|
Thank you! |
This was referenced Mar 9, 2021
Closed
Bump phpstan/phpstan from 0.12.78 to 0.12.81 in /composer/helpers/v1
dependabot/dependabot-core#3248
Merged
Bump phpstan/phpstan from 0.12.78 to 0.12.81 in /composer/helpers/v2
dependabot/dependabot-core#3249
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran multiple tests using Blackfire. Memoizing these expensive calls reduces both RAM consumption & execution time.
This is an example with running on https://github.com/pyguerder/phpstan-propel2-example/blob/master/generated-classes/App/AnalyzeMe2.php only: https://blackfire.io/profiles/compare/7f25525d-0676-40b8-a809-a92692106be6/graph
And this is an example running on my main project (154 classes): https://blackfire.io/profiles/compare/7cc0ea82-3727-4a95-b948-112678bc0991/graph
@ondrejmirtes can you please have a look at this?
Thanks in advance, best regards