-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
Slow sequential And #1331
Comments
Thanks for reporting, this looks interesting. Would you like to debug and pinpoint the issue? I'd start somewhere here. A pull request is welcome, too. Side note:
It might be editor-specific. I never had problems in mine increasing indentation level. Wondering if users of the other style https://rubystyle.guide/#consistent-multi-line-chains are affected by the growing indentation problem. |
These are both (or should be) sequential in our terminology (how your editor/formatter formats it is not the issue we'd format both of those the same), its just that the ruby precedence changes and one chains of the and matcher, and one chains off the include matcher, why that makes a difference I don't know yet. |
I was able to replicate the problem with both expressions. I believe they both hit the underlying problem, but ruby may compile the expressions differently. When expressed the first way, the match expression is compiled like this
When expressed the second way, the match expression is compiled like this
|
Subject of the issue
It appears that if And compounds are sequential then tests are running for a long time. Eg.:
this is running on my computer for 15 seconds, and each additional condition doubles the previous duration.
It's not a problem with nested and:
This is instant. But I prefer the previous sequential approach as it doesn't increase nesting level.
Your environment
The text was updated successfully, but these errors were encountered: