<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,28 +8,23 @@
 % Magnitude is the number of zeros in the size of the test arrays and lists.
 % Iterations is the number of times the benchmarks are executed prior to averaging their results.
 
+-define(BENCHMARKS, [list_seq, list_rand, list_square, array_seq, array_seq_list, array_seq_map, array_rand, array_square]).
+
 main(Magnitude) -&gt;
     main(Magnitude, 10).
 
 main(Magnitude,Iterations) -&gt; 
     Size = round(math:pow(10, Magnitude)),
-    Benchmarks = 
-	[
-	 {list_seq,fun(S) -&gt; list_seq(S) end},
-	 {list_rand,fun(S) -&gt; list_rand(S) end},
-	 {array_seq,fun(S) -&gt; array_seq(S) end},
-	 {array_rand,fun(S) -&gt; array_rand(S) end}
-	],
-    Results = benchmark_iterate(Size, Benchmarks, Iterations),
-    Averages = compute_averages(Results,length(Benchmarks),Iterations),
-    format_results(lists:reverse(Benchmarks), Averages).
+    Results = benchmark_iterate(Size, ?BENCHMARKS, Iterations),
+    Averages = compute_averages(Results,length(?BENCHMARKS),Iterations),
+    format_results(lists:reverse(?BENCHMARKS), Averages).
 
 format_results(B,A) -&gt;
     format_results(B,A,[]).
 
 format_results([], [], Output) -&gt;
-    io:format(&quot;~w~n&quot;, [Output]);
-format_results([{Benchmark,_}|Benchmarks],[Average|Averages],Output) -&gt;
+    [io:format(&quot;~w\t~10.2f~n&quot;, [Benchmark,Time]) || {Benchmark, Time} &lt;- Output];
+format_results([Benchmark|Benchmarks],[Average|Averages],Output) -&gt;
     format_results(Benchmarks,Averages,[{Benchmark,Average}|Output]).
 
 compute_averages(Results,Size,Iterations) -&gt;
@@ -79,11 +74,11 @@ benchmark_run(S,B) -&gt;
     benchmark_run(S,B,[]).
 
 benchmark_run(_,[],Results) -&gt; Results;
-benchmark_run(Size,[{BenchmarkName,Benchmark}|Benchmarks],Results) -&gt;
+benchmark_run(Size,[Benchmark|Benchmarks],Results) -&gt;
     TimeStart = time_microseconds(),
-    Benchmark(Size),
+    apply(array_test, Benchmark, [Size]),
     TimeEnd = time_microseconds(),
-    Result = {BenchmarkName,TimeEnd - TimeStart},
+    Result = {Benchmark,TimeEnd - TimeStart},
     benchmark_run(Size,Benchmarks,[Result|Results]).    
 
 list_build(Size) -&gt;
@@ -146,6 +141,36 @@ array_seq(Size, Array1, Array2, Array3) -&gt;
     Result = array:get(Index, Array1) * array:get(Index, Array2),
     array_seq(Index, Array1, Array2, array:set(Index, Result, Array3)).    
 
+array_seq_list(Size) -&gt;
+    Array1 = array_build(Size),
+    Array2 = array_build(Size),
+    array_seq_list(Size, Array1, Array2).
+
+array_seq_list(Size,Array1,Array2) -&gt;
+    array_seq_list(Size, Array1, Array2, []).
+
+array_seq_list(0,_,_,List) -&gt;
+    List;
+array_seq_list(Size, Array1, Array2, List) -&gt;
+    Index = Size - 1,
+    Result = array:get(Index, Array1) * array:get(Index, Array2),
+    array_seq_list(Index, Array1, Array2, [Result|List]).
+
+array_seq_map(Size) -&gt;
+    Array1 = array_build(Size),
+    Array2 = array_build(Size),
+    array_seq_map(Array1, Array2).
+
+array_seq_map(Array1,Array2) -&gt;
+    array:map(fun(Index, Val) -&gt; array:get(Index, Array1) * Val end, Array2).
+
+array_square(Size) -&gt;
+    array:map(fun(_, Val) -&gt; Val * Val end, array_build(Size)).
+
+list_square(Size) -&gt;
+    List = list_build(Size),
+    [X * X || X &lt;- List].
+
 array_rand(Size) -&gt;
     Array1 = array_build(Size),
     Array2 = array_build(Size),</diff>
      <filename>array_test.erl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>87a6eca21ca48f171d6248a9ee0743bd3927e9da</id>
    </parent>
  </parents>
  <author>
    <name>jde</name>
    <email>jde@opal.(none)</email>
  </author>
  <url>http://github.com/jkndrkn/erlang-toy/commit/e168470f2aad1af006208be4afb9d34749537e70</url>
  <id>e168470f2aad1af006208be4afb9d34749537e70</id>
  <committed-date>2009-09-29T18:58:26-07:00</committed-date>
  <authored-date>2009-09-29T18:58:26-07:00</authored-date>
  <message>Simplified list of benchmarks. Added a sequential array access benchmark that accumulates its result in a list. Added a sequential array access benchmark that utilizes array:map/3. Added list and array benchmarks that operate on single vectors using list comprehensions and array:map, respectively. Improved output formatting.</message>
  <tree>98391b851d00640de1d16d520f89c2bfe91f80fb</tree>
  <committer>
    <name>jde</name>
    <email>jde@opal.(none)</email>
  </committer>
</commit>
