10-08-2010 09:45 PM
p[op+o+z]=p[op+o]; p[op+o]=((b-EMPTY)!=0?b:0);You also seem to be doing stuff like calculating op+o twice. Use a local variable and only do a single addition vs. doing it twice. Check the code for other places that do this.
10-08-2010 09:50 PM
Can you think of any way to get rid of getValue? I was able to cut 300 milliseconds out by removing all the other function calls (used to be about 8). The function calls were all to convert to and from the pixel format (the 'q' variable).
The code was written for 8bits per pixel, format is RRRGGGBB. If you don't know how to convert to and from:
component = (decimalValueOfpackedComponent / ((2^numberOfBitsForPackedComponent)-1)) * 255
10-08-2010 09:53 PM - edited 10-08-2010 09:58 PM
I will work on the loop (until I can remove it), and should've tried harder to remove duplicate math equations.
10-08-2010 09:59 PM
I think if you store q[] and c[] as a IntIntHashtable... you will get a faster access.
It is native and very fast. Try it out.
10-08-2010 10:22 PM
Tried it out, reaked havok on the way the graphics are drawn. Function calls slowed it down too.
Statistics as of right now: Full screen graphics drawing: 2 milliseconds, Process: 189 milli... wait a second. What happened? The time variable is returning 1089 milliseconds!! How did it get over a second again?
10-08-2010 10:30 PM - edited 10-08-2010 10:31 PM
You're testing on a real device?
10-08-2010 10:36 PM
Do you think 4 if statements would be better then a loop? What about a large switch statement?
Can you think of anything way that:
((r*=5)%(getValue(pOpo-b)/5+2)>5)
Can be optimized?
10-08-2010 10:37 PM
No, give me a few minutes and I can get you real device stats.
10-09-2010 12:53 AM
Scratch that, after 2 hours of trying I still can't get Eclipse to connect to my Storm2. If I disconnect the USB cable then Eclipse fails (obviously) and my BlackBerry finishes connecting, then exists debug mode.
10-09-2010 07:31 AM
rcmaniac25 wrote:
Do you think 4 if statements would be better then a loop? What about a large switch statement?
Can you think of anything way that:
((r*=5)%(getValue(pOpo-b)/5+2)>5)Can be optimized?
It's hard to tell. You really have to measure each expression by themselves.
It'll probably be faster inlining four boolean expressions i.e.: bool ? 0 : (bool2 : ? 0 :bool3) etc. Try to figure out which occurs most and place those in beginning of the expression.
If you're getting 100-300ms on simulator... the real device will be much slower than that.