[plt-dev] Garden fence benchmark

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Fri May 1 20:12:36 EDT 2009

There have been recent discussions on plt-dev and plt-scheme about 
"garden fence" encryption (links below).  I've collected the solutions 
and benchmarked them.  The benchmark is included in my random access 
list library, which out performs the other functional solutions.

Results are below.  You can run this and other benchmarks (including the 
recently discussed "frequency counting" benchmark) by doing:

    mzscheme -p dvanhorn/ralist:1:12/run-benchmarks

For more info on the package, and source code for the benchmark see:
http://planet.plt-scheme.org/display.ss?package=ralist.plt&owner=dvanhorn

David

Garden fence encryption benchmark
=================================
http://list.cs.brown.edu/pipermail/plt-scheme/2009-March/031310.html

Key:

ve = imperative vector
http://list.cs.brown.edu/pipermail/plt-scheme/2009-March/031313.html

ra = random access list (translation of above)

dr = Felleisen output data driven design recipe
http://list.cs.brown.edu/pipermail/plt-scheme/2009-March/031344.html
(Omitted from 1,000,000 chars case since it takes too long)

co = Felleisen combinator
http://list.cs.brown.edu/pipermail/plt-dev/2009-April/000532.html

cy = Tobin-Hochstadt in-cycle
http://list.cs.brown.edu/pipermail/plt-dev/2009-April/000533.html

(define str (build-string 10000 (lambda (i) #\x)))

(encrypt str 20)
ve: cpu time: 8 real time: 8 gc time: 0
ra: cpu time: 18 real time: 18 gc time: 0
dr: cpu time: 14 real time: 14 gc time: 0
co: cpu time: 28 real time: 28 gc time: 0
cy: cpu time: 32 real time: 32 gc time: 0

(decrypt str 20)
ve: cpu time: 7 real time: 7 gc time: 0
ra: cpu time: 18 real time: 18 gc time: 0
dr: cpu time: 35 real time: 35 gc time: 0
co: cpu time: 50 real time: 50 gc time: 0
cy: cpu time: 42 real time: 42 gc time: 0

(define str (build-string 100000 (lambda (i) #\x)))

(encrypt str 20)
ve: cpu time: 92 real time: 93 gc time: 20
ra: cpu time: 228 real time: 228 gc time: 49
dr: cpu time: 1199 real time: 1198 gc time: 30
co: cpu time: 456 real time: 456 gc time: 123
cy: cpu time: 378 real time: 378 gc time: 49

(decrypt str 20)
ve: cpu time: 92 real time: 91 gc time: 19
ra: cpu time: 220 real time: 219 gc time: 42
dr: cpu time: 1386 real time: 1385 gc time: 122
co: cpu time: 767 real time: 769 gc time: 122
cy: cpu time: 585 real time: 592 gc time: 113

(define str (build-string 1000000 (lambda (i) #\x)))

(encrypt str 20)
ve: cpu time: 1580 real time: 1605 gc time: 746
ra: cpu time: 2724 real time: 2740 gc time: 890
co: cpu time: 6658 real time: 6689 gc time: 1874
cy: cpu time: 5904 real time: 5987 gc time: 1585

(decrypt str 20)
ve: cpu time: 1543 real time: 1556 gc time: 712
ra: cpu time: 2700 real time: 2751 gc time: 863
co: cpu time: 11991 real time: 12183 gc time: 3877
cy: cpu time: 9145 real time: 9187 gc time: 3136


Posted on the dev mailing list.