[
https://issues.apache.org/jira/browse/PIG-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13669915#comment-13669915
]
Aniket Mokashi commented on PIG-2569:
-------------------------------------
With java version 1.6.0_45+, the ratio is almost about 4-5, so the test fails
sometimes. It could be JVM problem. Do we need this test in pig?
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira