Skip to content
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

DSL: match(): support patterns array so Director renderer can make use of it #9583

Closed
Al2Klimov opened this issue Nov 16, 2022 · 2 comments · Fixed by #9585
Closed

DSL: match(): support patterns array so Director renderer can make use of it #9583

Al2Klimov opened this issue Nov 16, 2022 · 2 comments · Fixed by #9585
Assignees
Labels
area/configuration DSL, parser, compiler, error handling enhancement New feature or request needs feedback We'll only proceed once we hear from you again TBD To be defined - We aren't certain about this yet

Comments

@Al2Klimov
Copy link
Member

Al2Klimov commented Nov 16, 2022

Is your feature request related to a problem? Please describe.

Big OR trees of match() on the same subject are expensive, but Tom considers one big rendered regex less readable.

Describe the solution you'd like

  • We support match(["a*", "b*", "c*"], x)
  • At best we cache const and never-modified DSL expression results if we can
  • Director renders that one match call

Describe alternatives you've considered

Additional context

https://github.com/orgs/Icinga/projects/29

@Al2Klimov Al2Klimov added enhancement New feature or request area/configuration DSL, parser, compiler, error handling needs feedback We'll only proceed once we hear from you again TBD To be defined - We aren't certain about this yet labels Nov 16, 2022
@julianbrost
Copy link
Contributor

Big OR trees of match() on the same subject are expensive

I mean this is the problem, so we should put more effort into finding and fixing the cause. The suggestion in this issue feels more like working around the symptoms to me.

@julianbrost julianbrost removed their assignment Nov 16, 2022
@Al2Klimov
Copy link
Member Author

No and no. "the cause" is simply that the DSL is not smart. Or that Director rendering is not smart (for readability reasons). I could make the DSL smarter, see my 2nd considered alternative, but this would require:

  • operator== for every single class inheriting Expression in the AST
  • magic handling of match() in OR trees

It's cheaty, magic and someone has to spend time on the two bullets above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling enhancement New feature or request needs feedback We'll only proceed once we hear from you again TBD To be defined - We aren't certain about this yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants