#lang scribble/doc @(require scribble/manual scribble/eval (planet cce/scheme:6:3/planet) (planet cce/scheme:6:3/scribble) (for-label (this-package-in run-benchmarks) (this-package-in benchmarks/ra-list) (this-package-in benchmarks/freq-count) (this-package-in benchmarks/garden-fence))) @(define the-eval (let ([the-eval (make-base-eval)]) (the-eval `(require (planet ,(this-package-version-symbol benchmarks/ra-list)) (planet ,(this-package-version-symbol benchmarks/freq-count)) (planet ,(this-package-version-symbol benchmarks/garden-fence)))) the-eval)) @title[#:tag "run-benchmarks"]{Benchmarks} @defmodule/this-package[run-benchmarks] Runs all of the benchmarks for this package. @section{Random-access vs. Sequential-access lists} @defmodule/this-package[benchmarks/ra-list] This benchmark compares the performance of typical list operations for random and sequential lists. @defproc[(run-ra-list-benchmark) void?]{Runs this benchmark.} @;examples[#:eval the-eval (run-ra-list-benchmark)] @section{Frequency counting} @defmodule/this-package[benchmarks/freq-count] This benchmark compares an number of imperative and functional solutions to the problem of counting the frequencies of each number in a given list of numbers. See the thread starting @link["http://list.cs.brown.edu/pipermail/plt-scheme/2009-April/032250.html"]{here} for discussion. @defproc[(run-freq-count-benchmark) void?]{Runs this benchmark.} @;examples[#:eval the-eval (run-freq-count-benchmark)] @section{Garden fence encryption} @defmodule/this-package[benchmarks/garden-fence] This benchmark compares solutions to the problem of garden fence encryption. Garden fence encryption works as follows: you are given a plain text message (String) and a key (Nat). You scramble the message by a process that depends on the given key, producing a cipher text message (String) of the same length as the given plain text message. The scrambled message can be de-scrambled to obtain the original message by an inverse process when it is given the same key. @defproc[(encrypt [s string?] [k natural-number/c]) string?]{ Produce the cipher text of the given string using the given key.} @defproc[(decrypt [s string?] [k natural-number/c]) string?]{ Produce the plain text of the given string using the given key.} @examples[#:eval the-eval (encrypt "diesisteinklartext" 6) (decrypt "dkinleiasertittxse" 6)] The process of scrambling a message works in a zigzag form. The key gives the number of lines to the zigzag. So suppose we want to encrypt the message @scheme["diesisteinklartext"] with the key @scheme[6]. Imagine the characters of the string are arranged in a zigzag, or wave, or even @italic{fence}-like pattern, where the height of the wave, or zigzagging fency thing is @scheme[6]: @verbatim[#<