S
Sanny
I have a below code I use a lot in my Java Program.
u1,i,j,u2,ux,mz are integer
Arr1 is char[]
BigARRAY is int[]
----------------------INITIAL CODE
u1=i+1;u2=j+1;
ux=u1*3+u2;
if ((u1<9)&&(u2<9)) {
if (Arr1[ux]=='B') {mz++;BigARRAY[mz]=ux;}
}
-----------------------
How can this code be made more efficient.
Here is one effort by me by putting ux=u1*3+u2; inside the if
(condition)
------------------- IMPROVED CODE
u1=i+1;u2=j+1;
if ((u1<9)&&(u2<9)) {
ux=u1*3+u2;
if (Arr1[ux]=='B') {mz++;BigARRAY[mz]=ux;}
}
------------------
What else can be done to improve the above code. As this is being used
100000's times in For Loops. So If it's speed is improve twice then
program will work twice faster.
Is there any way to further improve the above code?
Bye
Sanny
u1,i,j,u2,ux,mz are integer
Arr1 is char[]
BigARRAY is int[]
----------------------INITIAL CODE
u1=i+1;u2=j+1;
ux=u1*3+u2;
if ((u1<9)&&(u2<9)) {
if (Arr1[ux]=='B') {mz++;BigARRAY[mz]=ux;}
}
-----------------------
How can this code be made more efficient.
Here is one effort by me by putting ux=u1*3+u2; inside the if
(condition)
------------------- IMPROVED CODE
u1=i+1;u2=j+1;
if ((u1<9)&&(u2<9)) {
ux=u1*3+u2;
if (Arr1[ux]=='B') {mz++;BigARRAY[mz]=ux;}
}
------------------
What else can be done to improve the above code. As this is being used
100000's times in For Loops. So If it's speed is improve twice then
program will work twice faster.
Is there any way to further improve the above code?
Bye
Sanny