You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@giraph.apache.org by "Jakob Homan (Created) (JIRA)" <ji...@apache.org> on 2011/11/15 02:17:52 UTC

[jira] [Created] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Simplify boolean expression in BspService::checkpointFrequencyMet
-----------------------------------------------------------------

                 Key: GIRAPH-87
                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
             Project: Giraph
          Issue Type: Improvement
            Reporter: Jakob Homan


{noformat}        if (superstep < firstCheckpoint) {
            return false;
        } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
            return true;
        } else {
            return false;
        }{noformat}
can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Jakob Homan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150679#comment-13150679 ] 

Jakob Homan commented on GIRAPH-87:
-----------------------------------

correct.  This optimization would be to keep the first if statement and then return the result of evaluating the else if argument directly ({{return (((superstep - ...}})
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>              Labels: newbie
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Avery Ching (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216365#comment-13216365 ] 

Avery Ching commented on GIRAPH-87:
-----------------------------------

+1
Thanks Eli, I committed on your behalf.
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch, GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216368#comment-13216368 ] 

Hudson commented on GIRAPH-87:
------------------------------

Integrated in Giraph-trunk-Commit #85 (See [https://builds.apache.org/job/Giraph-trunk-Commit/85/])
    GIRAPH-87: Simplify boolean expression in
BspService::checkpointFrequencyMet (Eli Reisman via aching). (Revision 1293545)

     Result = SUCCESS
aching : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1293545
Files : 
* /incubator/giraph/trunk/CHANGELOG
* /incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/BspService.java

                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch, GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Eli Reisman (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221208#comment-13221208 ] 

Eli Reisman commented on GIRAPH-87:
-----------------------------------

Thanks again, looking forward to doing more comprehensive fixes in the
future!

On Sat, Feb 25, 2012 at 12:19 AM, Avery Ching (Commented) (JIRA) <


                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch, GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Jakob Homan (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Homan reassigned GIRAPH-87:
---------------------------------

    Assignee: Eli Reisman
    
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Jakob Homan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215955#comment-13215955 ] 

Jakob Homan commented on GIRAPH-87:
-----------------------------------

Looks good except it fails checkstyle:
{noformat}<file name="/Users/jhoman/repos/giraph/src/main/java/org/apache/giraph/graph/BspService.java">
<error line="587" severity="error" message="Line matches the illegal pattern &apos;Trailing whitespace&apos;." source="com.puppycrawl.tools.checkstyle.checks.RegexpCheck"/>
<error line="587" column="5" severity="error" message="&apos;}&apos; should be on the same line." source="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
<error line="588" severity="error" message="Line matches the illegal pattern &apos;Trailing whitespace&apos;." source="com.puppycrawl.tools.checkstyle.checks.RegexpCheck"/>
</file>{noformat}
Kill the trailing spaces and move the else to the same line and we're good to go.
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Arun Suresh (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150298#comment-13150298 ] 

Arun Suresh commented on GIRAPH-87:
-----------------------------------

you would still need the first case..
for eg. if
superstep = 4
firstCheckpoint = 6 
checkpointFrequency = 2
would return true if we only have the else if
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>              Labels: newbie
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Eli Reisman (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eli Reisman updated GIRAPH-87:
------------------------------

    Attachment: GIRAPH-87.patch

This is an improved version of GIRAPH-87.patch that passes "mvn checkstyle:check" and of course also "mvn test". Not tested on a cluster.
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch, GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-87) Simplify boolean expression in BspService::checkpointFrequencyMet

Posted by "Eli Reisman (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eli Reisman updated GIRAPH-87:
------------------------------

    Attachment: GIRAPH-87.patch

This is the patch for GIRAPH-87 JIRA newbie issue. Passed "mvn test", not tested on cluster.
                
> Simplify boolean expression in BspService::checkpointFrequencyMet
> -----------------------------------------------------------------
>
>                 Key: GIRAPH-87
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-87
>             Project: Giraph
>          Issue Type: Improvement
>    Affects Versions: 0.2.0
>            Reporter: Jakob Homan
>            Assignee: Eli Reisman
>              Labels: newbie
>         Attachments: GIRAPH-87.patch
>
>
> {noformat}        if (superstep < firstCheckpoint) {
>             return false;
>         } else if (((superstep - firstCheckpoint) % checkpointFrequency) == 0) {
>             return true;
>         } else {
>             return false;
>         }{noformat}
> can be simplified to just return the result of the else if evaluation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira