[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
FWIW: http://code.google.com/p/google-web-toolkit/wiki/BooleanIfExpressionOptimization http://code.google.com/p/google-web-toolkit/wiki/IfToTernaryExpressionOptimization Thanks again for banging on these. I've been meaning to do it for ages... On Wed, Jun 10, 2009 at 9:11 PM, mmastrac.altern...@gmail.com wrote: Reviewers: scottb, Description: As suggested by scottb, we can optimize certain if statements to their boolean equivalents, ie: if (a()) {b()} else {c()} - a()?b():c() if (a()) {b()} - a()b() if (a()) {} else {b()} - a()||b() Please review this at http://gwt-code-reviews.appspot.com/36801 Affected files: dev/core/src/com/google/gwt/dev/js/JsStaticEval.java dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
No problem... I haven't handled the common super-expression case (if (test) { return a; } else {return b; } - return test ? a : b), but that one should be pretty easy to tackle for a limited set of common super-expressions. On 11-Jun-09, at 5:53 AM, Joel Webber wrote: FWIW: http://code.google.com/p/google-web-toolkit/wiki/BooleanIfExpressionOptimization http://code.google.com/p/google-web-toolkit/wiki/IfToTernaryExpressionOptimization Thanks again for banging on these. I've been meaning to do it for ages... On Wed, Jun 10, 2009 at 9:11 PM, mmastrac.altern...@gmail.com wrote: Reviewers: scottb, Description: As suggested by scottb, we can optimize certain if statements to their boolean equivalents, ie: if (a()) {b()} else {c()} - a()?b():c() if (a()) {b()} - a()b() if (a()) {} else {b()} - a()||b() Please review this at http://gwt-code-reviews.appspot.com/36801 Affected files: dev/core/src/com/google/gwt/dev/js/JsStaticEval.java dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
LGTM. Committed at r5540 with minor tweaks. http://gwt-code-reviews.appspot.com/36801 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
Matt, Could you review these two follow-on patches? The second depends on the first. This is mostly non-functional cleanup to make things a little simpler to read. The only substantive change is this: Presently, if we have a CanBooleanEval that fails to resolve, we do nothing else. My second patch allows the failure case to fall through and check for more simplifications. Thanks, Scott --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~--- cleanup2.patch Description: Binary data cleanup1.patch Description: Binary data
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
Both LGTM. Good catch, thanks. :) On 11-Jun-09, at 1:15 PM, Scott Blum wrote: Matt, Could you review these two follow-on patches? The second depends on the first. This is mostly non-functional cleanup to make things a little simpler to read. The only substantive change is this: Presently, if we have a CanBooleanEval that fails to resolve, we do nothing else. My second patch allows the failure case to fall through and check for more simplifications. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---