Hi,
I wanted to test Java3D Vector operation, but I found the
strange thing in my code.
In following code, the first part is the same as the second
part, so 'for''s computing time would be the same as the second
'for''s.
but the result is different as following.
I don't know why.
ok
test 0's duration : 3968.0 test 1's duration : 1782.0 test 0's duration : 3937.0 test 1's duration : 1750.0 ok test 0's duration : 1734.0 test 1's duration : 1735.0 test 0's duration : 1812.0 test 1's duration : 1719.0 //////////////////
public void Test0()
{ double d0,d1; double t0,t1,t2; float a; // test defined variable Vector3f v0 = new Vector3f(1.0f,2.0f,3.0f); Vector3f v1 = new Vector3f(3.0f,2.0f,1.0f); float[] f0 = new float[3]; float[] f1 = new float[3]; f0[0] = 1.0f; f0[1] = 2.0f; f0[2] = 3.0f; f1[0] = 3.0f; f1[1] = 2.0f; f1[2] = 1.0f; // int j; long i; System.out.println(" ok "); for(j=0;j<2;j++) { t0 = System.currentTimeMillis(); // first test for(i=0;i<100000000;i++) { a = v0.dot(v1); } // t1 = System.currentTimeMillis(); // second test for(i=0;i<100000000;i++) { a = v0.dot(v1); } // t2 = System.currentTimeMillis(); System.out.println("test 0's duration : "+ (t1-t0)); System.out.println("test 1's duration : "+ (t2-t1)); } // for j System.out.println(" ok "); for(j=0;j<2;j++) { t0 = System.currentTimeMillis(); // first test for(i=0;i<100000000;i++) { a = v0.dot(v1); } // t1 = System.currentTimeMillis(); // second test for(i=0;i<100000000;i++) { a = v0.dot(v1); } // t2 = System.currentTimeMillis(); System.out.println("test 0's duration : "+ (t1-t0)); System.out.println("test 1's duration : "+ (t2-t1)); } // for j } |
- Re: [JAVA3D] [Java3D] Strange... 오승우\(Sengwoo Oh\)
- Re: [JAVA3D] [Java3D] St... Brad Christiansen
- Re: [JAVA3D] [Java3D] St... Justin Couch
- [JAVA3D] painting is... Karsten Fries
- Re: [JAVA3D] pai... Pasi Paasiala
- Re: [JAVA3D] pai... Karsten Fries
- Re: [JAVA3D] [Java3D] St... Richard Smith - Systems Engineer - Melbourne