??? 08/18/06 13:36 Read: times |
#122559 - Comparison: Responding to: ???'s previous message |
Algorithm tmin tavg tmax (in us) square root algo, optimized 161 176 191 brute force 244 246 249 table based approximation 6 363 399 square root algo, unoptimized 1058 1077 1092 tested with input values from 0 to 4294840760, step size 10357. but these two facts reveal that aginst what you think the original programmers were not stupid. As I said before, the code was never intended for a '51, I just did that for fun. The "slowest" thing the code ever ran on was a 68000, which can (at least from a look at its instruction set) natively shift 32 bit variables, which speeds up the algorithm quite a bit since it eliminates library calls for the shifts and adds. The square root calculation is rarely needed (the main task of the code is doing FFTs) and space was usually more of a concern than CPU cycles. |
Topic | Author | Date |
Things you find ... | 01/01/70 00:00 | |
10 lines PLUS a whole bunch of 'lines' | 01/01/70 00:00 | |
I forgot to mention ... | 01/01/70 00:00 | |
sounds reasonable | 01/01/70 00:00 | |
I'll optimize it tomorrow. | 01/01/70 00:00 | |
haven't heard of that one | 01/01/70 00:00 | |
Do it using the RLC instruction. | 01/01/70 00:00 | |
Optimized results: | 01/01/70 00:00 | |
how does the lookup table approach time | 01/01/70 00:00 | |
Comparison: | 01/01/70 00:00 | |
Table error | 01/01/70 00:00 | |
No error. | 01/01/70 00:00 | |
So how did you calculate/measure the average? | 01/01/70 00:00 | |
Right below the table: | 01/01/70 00:00 | |
I do the same thing | 01/01/70 00:00 | |
Lookup table will win hands down | 01/01/70 00:00 | |
For floats, yes. For long ints ... not so sure. | 01/01/70 00:00 | |
one more thing | 01/01/70 00:00 | |
if the precision is not 'critical' | 01/01/70 00:00 | |
Another source | 01/01/70 00:00 | |
What about a Hardware Solution? | 01/01/70 00:00 |