Another quick one: since you're comparing points and distances and sin/cos/tans, does it make sense to compare points i=25 and j=50, and then again points i=50 and j=25? Would the calculations yield the same results? In that case, you could just halve your computation to (i<j) instead of (i!=j), and instead of getting rid of the diagonal of the matrix, get rid of the whole triangle below it (or just do something checking propTwelve if applies)
Besides Justin recommendation, also a precalculated look-up table for sqrt, sin,cos and atan2 might come in handy if you can bear with the error tradeoff (they are REALLY expensive functions). Also try a*a directly instead of Math.Pow(a,2). Also, isn't "count" exactly the length of tempCompArray? Why keep track of it? Also, if you write the first three ifs as (if a && b && c), b && c are NEVER calculated if a is false, so you can skip 3 lines (and make your branch predictor happier :) Also, since you're referencing array[i] and array[j] a vast number of times, maybe is a good idea at the top of the loop: itemi=tempArray[i] itemj=temArray[j] hence having a direct memory reference instead of a double reference (address of tempArray + address of the ith element) Also, you use a few times "Math.abs(a-b)<=1". Try a oneliner function near1(a,b) { c=a+b; return c>=-1&&c<=1}, I think this might be faster (and again you get rid of the IF involved in the ABS function). Well, 1:41AM here, have to sleep :) On Thu, Aug 4, 2016 at 12:21 AM, bilbosax <waspenc...@comcast.net> wrote: > Distances are selected by the user using a dropdownlist in the range of .25 > to 4 miles. Distance is the key to the whole thing here and has to be > exact, I can't be off by 10ths of a mile, it needs to be within say, 20 > feet. > > > > -- > View this message in context: > http://apache-flex-users.2333346.n4.nabble.com/Workers-and-Speed-tp13098p13196.html > Sent from the Apache Flex Users mailing list archive at Nabble.com. >