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

feat: Add special form expression optimizations #12474

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pramodsatya
Copy link
Collaborator

WIP: Please do not review

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 27, 2025
Copy link

netlify bot commented Feb 27, 2025

Deploy Preview for meta-velox ready!

Name Link
🔨 Latest commit 46ebde5
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67c0c1f875a5f40008dcd69f
😎 Deploy Preview https://deploy-preview-12474--meta-velox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Yuhta
Copy link
Contributor

Yuhta commented Feb 27, 2025

Why not doing it when we compile the expressions? exec::Expr is meant to be runtime expressions and constant folding should be finished before it.

@pramodsatya
Copy link
Collaborator Author

Why not doing it when we compile the expressions? exec::Expr is meant to be runtime expressions and constant folding should be finished before it.

Thanks for the suggestion @Yuhta, but I don't quite follow. The virtual function constructSpecialForm in FunctionCallToSpecialForm is called by the expression compiler in ExprCompiler.cpp -> compileExpressions() -> compileRewrittenExpression(). When an expression like (1 = 2) and (2 != 4) is compiled for instance, it will have as inputs ConstantExprs with values false and true because the input expressions to core::CallTypedExpr AND are constant folded during compilation. So when the function ConjunctCallToSpecialForm::constructSpecialForm() is called by the expression compiler, this optimization intends to return a ConstantExpr with value false instead of the AND ConjunctExpr when any of the inputs is (or has been constant folded to) false.
Could you please elaborate where in the expression compiler the changes should be moved to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants