4 Benchmarks
(require data/ralist/run-benchmarks) | package: ralist |
Runs all of the benchmarks for this package.
4.1 Random-access vs. Sequential-access lists
(require data/ralist/benchmarks/ra-list) | |
package: ralist |
This benchmark compares the performance of typical list operations for random and sequential lists.
procedure
(run-ra-list-benchmark) → void?
4.2 Contracted vs. Uncontracted bindings
(require data/ralist/benchmarks/contract) | |
package: ralist |
This benchmark compares the performance of the contracted and uncontracted bindings.
procedure
(run-contract-benchmark) → void?
4.3 Frequency counting
(require data/ralist/benchmarks/freq-count) | |
package: ralist |
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.
procedure
(run-freq-count-benchmark) → void?
4.4 Garden fence encryption
(require data/ralist/benchmarks/garden-fence) | |
package: ralist |
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.
procedure
(encrypt s k) → string?
s : string? k : natural-number/c
procedure
(decrypt s k) → string?
s : string? k : natural-number/c
;;;; 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.
procedure
(run-garden-fence-benchmark) → void?