| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#11
| |||
| |||
| John Thingstad wrote: > På Mon, 16 Jun 2008 16:03:05 +0200, skrev vanekl <vanek@acd.net>: > >> This algo appears to be more efficient than John's >> since it is not recomputing the factorization over and over again for >> each new test of primality. > > Appears being the operative word. > Goes back to the old saying that Lispers know the value of everything > and the cost of nothing. > > My algorithm can rest in the L1 cache. It doesn't need to access memory. > (no consing) > Although there are fewer iterations each step is sufficiently expensive > that you still loose. > For bigger primes there are more efficient algorithms also so that one > is never optimal. > > -------------- > John Thingstad Agreed. From a high-level analysis, I like the lazy algo better. Of course implementation details can totally destroy an algorithms effectiveness, even if the algo has good big-O qualities. The virtual machine ultimately has the last say, when running the algo in the real world. However, this doesn't preclude the possibility, in the future, for the lazy algo to come out faster if the virtual machine this is run on has different optimizations. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.