Cost of Composition vs Pure Function
- To: mathgroup at smc.vnet.net
- Subject: [mg93646] Cost of Composition vs Pure Function
- From: Raffy <raffy at mac.com>
- Date: Thu, 20 Nov 2008 04:56:01 -0500 (EST)
The speed difference between these two evaluations seems odd, considering they are effectively the same thing: m = RandomReal[{0, 1}, {10, 1000, 1000}]; Total[Total[#]]& /@ m; // Timing => 0.14 sec Composition[Total, Total] /@ m; // Timing => 0.983 sec Other than the Identity and Inverse Function transformation, where is this overhead coming from? Thanks.
- Follow-Ups:
- Re: Cost of Composition vs Pure Function
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Cost of Composition vs Pure Function