I made some improvements to both the Factor and Forth versions of LC53 in both speed and style. I also fixed a bug in the games-and-simulations section, although that didn't have anything to do with the encryption. I also fixed my test.txt file so that it would say "Fourth Amendmend" rather than "Second Amendment." Here are the new files.
Factor: www.rosycrew.org/LC53.factor Forth: www.rosycrew.org/LC53.4th test: www.rosycrew.org/test.txt Here are the new times: Factor -------- 9 minutes and 14 seconds SwiftForth ------------------22 seconds assembly-language ----------17 seconds In regard to Forth, the biggest gain came from inlining a lot of the lower-level words. I also rewrote HOW-FAR to use a BEGIN loop rather than a DO loop, but that only shaved off a few more seconds (from 28 down to 22) --- this is as compared to shaving off minutes just by inlining. In regard to Factor, all that I did was inlining as I wasn't able to figure out what Slava was talking about in regard to rewriting HOW-FAR. This shaved off about 3 minutes from the Factor time, which was pretty good, although not as significant as the effect on Forth. Apparently, all of that calling of functions really kills the speed. I have read both of Michael Abrash's books on assembly language (first for the 8088 and then for the Pentium), and he emphasizes the avoidance of jumps and calls as being important. Still, I was amazed at how much of an effect inlining had on the program. I also moved the functions closer together, which may have helped. I think what happened here is that, previously, the cache was having to be reloaded repeatedly. With the new arrangement, everything was in the cache and the entire shebang ran without any cache reloading. I say this as if I actually know what a cache is --- but I don't anymore. We have different manufacturers making Pentium-compatible processors nowadays, and there is not much compatibility in the low-level details. My laptop has an "AMD Turion 64 Mobile Technology MK38" (K8), if that means anything to you guys. Compiler-optimization has gotten so complicated nowadays that I just do it by guess and by golly --- I don't really have any way of predicting run-times the way that I did back in the pre-Pentium era. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
