You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Johnny Zhang (Created) (JIRA)" <ji...@apache.org> on 2012/03/03 01:37:59 UTC

[jira] [Created] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Fix org.apache.pig.test.TestInvoker.testSpeed
---------------------------------------------

                 Key: PIG-2569
                 URL: https://issues.apache.org/jira/browse/PIG-2569
             Project: Pig
          Issue Type: Bug
            Reporter: Johnny Zhang


the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
{noformat}
@Test
    public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
        EvalFunc<Double> log = new Log();
        Tuple tup = tf_.newTuple(1);
        long start = System.currentTimeMillis();
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long staticSpeed = (System.currentTimeMillis()-start);
        start = System.currentTimeMillis();
        log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long dynamicSpeed = System.currentTimeMillis()-start;
        System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
        assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
    }
{noformat}

I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first ru, but fail in the second run.


--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Andrey Klochkov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427781#comment-13427781 ] 

Andrey Klochkov commented on PIG-2569:
--------------------------------------

This test fails for me when code coverage calculation is enabled, it happens permanently on my MacBook 2.26GHz with Sun JDK 1.6.0_33-b03-424. The ratio calculated by test is between 5 and 6 in this case.

How about excluding this test explicitly when Clover is enabled?

Johnny, could it be the case that Clover was enabled when you were hitting the problem? 
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Andrey Klochkov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Klochkov updated PIG-2569:
---------------------------------

    Affects Version/s: 0.9.2
               Status: Patch Available  (was: Open)

Attaching patch. The test was moved into a separate class to be able to disable it in build.xml when Clover is enabled. 
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: PIG-2569.patch
>
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Andrey Klochkov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428424#comment-13428424 ] 

Andrey Klochkov commented on PIG-2569:
--------------------------------------

Per my observations, with Clover disabled the ratio is ~2 or less. When Clover is enabled, it's between 5 and 6. I applied the fix in our fork of Pig and haven't seen failures in our CI after that (with Clover enabled). 
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: PIG-2569.patch
>
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Andrey Klochkov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Klochkov updated PIG-2569:
---------------------------------

    Attachment: PIG-2569.patch
    
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: PIG-2569.patch
>
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Johnny Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427790#comment-13427790 ] 

Johnny Zhang commented on PIG-2569:
-----------------------------------

Andrey, yes Clover is enabled when test was running. I think it is a good idea to disable this test when Clover is enabled, in build.xml
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

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

Johnny Zhang commented on PIG-2569:
-----------------------------------

The Java build I am using is JDK6u26.
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

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

Johnny Zhang updated PIG-2569:
------------------------------

    Description: 
the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
{noformat}
@Test
    public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
        EvalFunc<Double> log = new Log();
        Tuple tup = tf_.newTuple(1);
        long start = System.currentTimeMillis();
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long staticSpeed = (System.currentTimeMillis()-start);
        start = System.currentTimeMillis();
        log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long dynamicSpeed = System.currentTimeMillis()-start;
        System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
        assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
    }
{noformat}

I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.


  was:
the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
{noformat}
@Test
    public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
        EvalFunc<Double> log = new Log();
        Tuple tup = tf_.newTuple(1);
        long start = System.currentTimeMillis();
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long staticSpeed = (System.currentTimeMillis()-start);
        start = System.currentTimeMillis();
        log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
        for (int i=0; i < 1000000; i++) {
            tup.set(0, (double) i);
            log.exec(tup);
        }
        long dynamicSpeed = System.currentTimeMillis()-start;
        System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
        assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
    }
{noformat}

I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first ru, but fail in the second run.


    
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428421#comment-13428421 ] 

Dmitriy V. Ryaboy commented on PIG-2569:
----------------------------------------

Can you guys confirm that the test passes with Clover disabled?
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>         Attachments: PIG-2569.patch
>
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Dmitriy V. Ryaboy (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13222684#comment-13222684 ] 

Dmitriy V. Ryaboy commented on PIG-2569:
----------------------------------------

When I wrote that test, the ratio was more like two, and the idea behind hardcoding 5 was that if it's that slow, it's not worth using and we should rethink. 

I am curious why it just started failing for people -- the code's been around for a year, and I got reports of the test failing here and in Elephant Bird a week apart. Is there a new Java build that drastically slowed down reflection or something?

What is your java environment?
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy updated PIG-2569:
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.11
         Assignee: Andrey Klochkov  (was: Dmitriy V. Ryaboy)
           Status: Resolved  (was: Patch Available)

Committed to trunk. Thanks Andrey!
                
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.2
>            Reporter: Johnny Zhang
>            Assignee: Andrey Klochkov
>             Fix For: 0.11
>
>         Attachments: PIG-2569.patch
>
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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] (PIG-2569) Fix org.apache.pig.test.TestInvoker.testSpeed

Posted by "Dmitriy V. Ryaboy (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy V. Ryaboy reassigned PIG-2569:
--------------------------------------

    Assignee: Dmitriy V. Ryaboy
    
> Fix org.apache.pig.test.TestInvoker.testSpeed
> ---------------------------------------------
>
>                 Key: PIG-2569
>                 URL: https://issues.apache.org/jira/browse/PIG-2569
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Johnny Zhang
>            Assignee: Dmitriy V. Ryaboy
>
> the Pig unit test org.apache.pig.test.TestInvoker.testSpeed pass sometimes and fail sometimes. I think this test need further polish, look at the code:
> {noformat}
> @Test
>     public void testSpeed() throws IOException, SecurityException, ClassNotFoundException, NoSuchMethodException {
>         EvalFunc<Double> log = new Log();
>         Tuple tup = tf_.newTuple(1);
>         long start = System.currentTimeMillis();
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long staticSpeed = (System.currentTimeMillis()-start);
>         start = System.currentTimeMillis();
>         log = new InvokeForDouble("java.lang.Math.log", "Double", "static");
>         for (int i=0; i < 1000000; i++) {
>             tup.set(0, (double) i);
>             log.exec(tup);
>         }
>         long dynamicSpeed = System.currentTimeMillis()-start;
>         System.err.println("Dynamic to static ratio: "+((float) dynamicSpeed)/staticSpeed);
>         assertTrue( ((float) dynamicSpeed)/staticSpeed < 5);
>     }
> {noformat}
> I understand this test is trying to prevent the initicialization time of InvokeForDouble doesn't take too long, but the ratio 5 is hardcoded, and there is no solid logic behind it why it is 5. For my understand, when the server resouce is low, ratio could be larger than 5, but it doesn't mean code has problem. For our case, the code never change, but it pass in the first run, but fail in the second run.

--
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