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
Typecombinator union optimization #2078
Conversation
cdeb6c1
to
a93a987
Compare
I've reset the latest commit because it looked like causing a infinite loop or something in the CI. |
368ae34
to
092264b
Compare
The bucket logic is almost working, but I suspect that the performance improvement is going to be small. We can only optimize large union of non-constant and non-array types. |
just ran a few blackfire profiles. it seems to improve this example by 40% (45secs -> 26 secs). all other things I tested (my oversized array cases) were nearly the same as before:
taken from rectorphp/rector#7649 |
Oh, that was better than I thought 👍 Thanks for the info, I am now still motivated to continue this PR:smile: |
My main motivation for this optimization was to speed up situation where we have ObjectType and in subtractedType there's like 64 ObjectTypes in a union - typical when analysing NodeScopeResolver or MutatingScope... |
Yeah, I think it has improved a little already, but not as significant than I thought. |
8a49c21
to
04ccb01
Compare
ok |
cc710e8
to
22f2012
Compare
The current implementation should be faster significantly. |
running #2078 (comment) thru 22f2012 is already way faster then 1.9.x-dev great job |
a961cc9
to
b3a88d8
Compare
bd4da1d
to
ac998f5
Compare
The former implementation ran phpstan-src/src/Type/TypeCombinator.php Line 201 in 80b5cdd
and phpstan-src/src/Type/TypeCombinator.php Line 238 in 80b5cdd
This could union If we sort |
ac998f5
to
406c9b9
Compare
fyi, I compared the latest revision of this PR with 1.9.x-dev and it seems there is no perf difference anymore. |
What about analyzing this file? #2078 (comment) |
no improvement. (don't look at the absolute numbers.. I don't know on which computer I did the measures within comment of this file I also did blackfire profiles and these also don't show a difference on my windows computer. |
Thank you for confirming the performance!
Yeah, I'm stuck with this problem now... |
Alright, don't worry about this, it was my idea and it wasn't very good 😊 If you get a new insight you can try it again but don't feel obligated to do so 😊 Thank you: |
No description provided.