On this page:
4.1 Random-access vs. Sequential-access lists
4.2 Frequency counting
4.3 Garden fence encryption

4 Benchmarks

 (require (planet dvanhorn/ralist:1:11/run-benchmarks))

Runs all of the benchmarks for this package.

4.1 Random-access vs. Sequential-access lists

 (require (planet dvanhorn/ralist:1:11/benchmarks/ra-list))

This benchmark compares the performance of typical list operations for random and sequential lists.

(run-ra-list-benchmark)  void?

Runs this benchmark.

4.2 Frequency counting

 (require (planet dvanhorn/ralist:1:11/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?

Runs this benchmark.

4.3 Garden fence encryption

 (require (planet dvanhorn/ralist:1:11/benchmarks/garden-fence))

This benchmark compares an imperative vector and an analogous purely-functional solution to the problem of garden fence encryption.

Provided that the cleartext is "diesisteinklartext" then the text has to be processed into a zigzag-like form. The "key" is the number of lines in the zigzag.

An example:

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

Then the resulting encrypted text is "dkinleiasertittxse", which results in appending the characters from all lines, starting with the first.

(encrypt s k)  string?
  s : string?
  k : natural-number/c

Produce the cipher text of the given string using the given key.

(decrypt s k)  string?
  s : string?
  k : natural-number/c

Produce the plain text of the given string using the given key.


  > (encrypt "diesisteinklartext" 6)


  > (decrypt "dkinleiasertittxse" 6)


See the thread starting here and here for discussion.

(run-garden-fence-benchmark)  void?

Runs this benchmark.