On Sun, Aug 24, 2014 at 11:09 AM, Beat Cornaz <b.cor...@gmx.net> wrote:
> I am a bit at a loss, as I would be surprised if my way would be like 25 > times faster than the fastest known algorithm. Did I make a mistake in > implementing Dicks code (although > Dick also reports 2 minutes to do the job, as my way does it in 5.6 secs). > What is happening here. > I even suspect, that I can improve more on my improved way (by only > calculating half of the perms and swapping the 1's and 2's. I might apply > that principle more (like only calculating 1/4 of the perms and do some > swapping, or even better). I will look into that later. > The fastest algorithm doesn't take into account the difference between LiveCode's native C speed based on a single command vs. the much slower execution of a substantial amount of transcript/livecode/<whatever we call the code in livecode these days>. For example, a sorting algorithm written in LC would be *much* slower than the sort command, even if it used a more efficient algorithm. My permutations code (and perhaps yours) makes extensive use of the replace command specifically because it's a single command that for our purposes here gets a lot done. That's key in speeding things up. gc _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode