Comment explaining choice of map+to_list over fold.
authorSiraaj Khandkar <siraaj@khandkar.net>
Thu, 9 Aug 2012 13:03:22 +0000 (09:03 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 9 Aug 2012 13:03:22 +0000 (09:03 -0400)
003/src/life.erl

index 5f91d26..ddb5115 100644 (file)
@@ -94,6 +94,9 @@ do_print_status(Bar, X, Y, N, GenCount, TimeMic, PrintTimeMic) ->
 
 
 do_print_board(Board) ->
+    % It seems that just doing a fold should be faster than map + to_list
+    % combo, but, after measuring several times, map + to_list has been
+    % consistently (nearly twice) faster than either foldl or foldr.
     RowStrings = array:to_list(
         array:map(
             fun(_, Row) ->
This page took 0.028417 seconds and 4 git commands to generate.