-
Notifications
You must be signed in to change notification settings - Fork 36
Optimize Enum::detectConstants() by using assertion #94
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
Conversation
38dd474 to
ff749d4
Compare
src/Enum.php
Outdated
| } | ||
| } | ||
|
|
||
| return empty($ambiguous); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not throw an exception here like before? I am kind of against using assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also see not why this should be so much faster.
549746b to
87a4b77
Compare
|
Assertions should be enabled in development move only and is designed for cases that should be evaluate to Please run the following benchmark with 9019505 applied before
then comment out the code for assertions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understand, great idea!
87a4b77 to
42f65d0
Compare
42f65d0 to
978ee3a
Compare
... on checking for ambiguous enumerator values.
This will speed up first enumeration call with a factor of ~3.
The BC break is because of it throws an AssertionError if
zend.assertions = 1or throws nothing.