4 Benchmarks
(require (planet dvanhorn/ralist:1:15/run-benchmarks)) |
Runs all of the benchmarks for this package.
4.1 Random-access vs. Sequential-access lists
(require (planet dvanhorn/ralist:1:15/benchmarks/ra-list)) |
This benchmark compares the performance of typical list operations for random and sequential lists.
(run-ra-list-benchmark) → void? |
4.2 Frequency counting
(require (planet dvanhorn/ralist:1:15/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 here for discussion.
(run-freq-count-benchmark) → void? |
4.3 Garden fence encryption
(require (planet dvanhorn/ralist:1:15/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.
(encrypt s k) → string? |
s : string? |
k : natural-number/c |
(decrypt s k) → string? |
s : string? |
k : natural-number/c |
Examples: |
> (encrypt "diesisteinklartext" 6) |
"dkinleiasertittxse" |
> (decrypt "dkinleiasertittxse" 6) |
"diesisteinklartext" |
;;;; 1. d k = (d k) = "dk" |
;;;; 2. i n l = (i n l) = "inl" |
;;;; 3. e i a = (e i a) = "eia" |
;;;; 4. s e r t = (s e r t) = "sert" |
;;;; 5. i t t x = (i t t x) = "ittx" |
;;;; 6. s e = (s e) = "se" |
An imperative, vector-based algorithm.
A functional translation of the above using random-access lists.
A functional algorithm designed by output structure.
A combinator style algorithm.
A cyclic sequence algorithm.
See the thread starting here and here for discussion.
(run-garden-fence-benchmark) → void? |