??? 08/18/06 12:44 Read: times |
#122556 - how does the lookup table approach time Responding to: ???'s previous message |
nobody - correction I - will care about the time the code takes, if it is not in comparison with the lookup method.
Did you time it with 'easy' or 'tough' numbers (the sqrt calcultion time is highly variable), now (12.5 MHz/1-clocker) and old, has been around for over ten years, running on different processors reveals that you may, after the advances in processor speed made ove 10 years, be able to replace the table lookup (I would not) but these two facts reveal that aginst what you think the original programmers were not stupid. On the '51 available to them when they did the original code the process would have taken more than 2ms. Now, that you have used a faster processor and 'feel' that using code would be 'better' (stupid) or 'good enough' (possibly), DO think about the following: What if an enhancement required next year makes the coded sqrt too slow (again) Erik |
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 |