I wrote a program to crack a linear-congruential (LC) encryption system. The 
system is called LC53 (my invention), and it uses these constants:

unity = 2^32-5
mult = 2^32-333333333

LC encryption is fairly easy to crack, so nobody uses it in practice, but it 
makes for a good test of a language in regard to integer arithmetic and 
recursion. Before I put this benchmark in my book, I hope that you guys will 
look over the Factor version with an eye toward improving the speed 
(primarily) and the style (secondarily).

If you want to port the program over to another language (especially C and 
Java), I would appreciate that too. In the Forth program, I have a 
compiler-directive called SwiftForth? that, if set true, will compile an 
assembly-language version of the program. This is written using the 
SwiftForth assembler, so it will only compile under SwiftForth. When 
SwiftForth? is set false, the program will compile under any 32-bit 
ANS-Forth system (I used SwiftForth for the benchmark given below).

The good news is that Factor came out about an order of magnitude faster 
than I expected. That really speaks well of Slava and the others who have 
worked on the optimizer in the Factor compiler. These are the times (on my 
laptop):

Factor ------------- 12 minutes and 11 seconds
Forth --------------- 2 minutes and 23 seconds
assembly language ---------------- 17 seconds

This is the Factor program: www.rosycrew.com/LC53.factor
This is the Forth program:   www.rosycrew.com/LC53.4th
This is the test file: www.rosycrew.com/test.txt


------------------------------------------------------------------------------
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

Reply via email to