From: Siraaj Khandkar Date: Thu, 9 Aug 2012 13:03:22 +0000 (-0400) Subject: Comment explaining choice of map+to_list over fold. X-Git-Url: https://git.xandkar.net/?p=cellular-automata.git;a=commitdiff_plain;h=af47aa3763380022a5f39d7f8c2c662db9f03766 Comment explaining choice of map+to_list over fold. --- diff --git a/003/src/life.erl b/003/src/life.erl index 5f91d26..ddb5115 100644 --- a/003/src/life.erl +++ b/003/src/life.erl @@ -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) ->