Timing of Table
- To: mathgroup at smc.vnet.net
- Subject: [mg43229] Timing of Table
- From: "Mariusz Jankowski" <mjkcc at usm.maine.edu>
- Date: Wed, 20 Aug 2003 22:25:35 -0400 (EDT)
- Organization: University of Maine System/MSLN
- Sender: owner-wri-mathgroup at wolfram.com
Dear Mathematica Users, Can someone explain the timing difference between the following two code samples. I am guessing it has to do with the auto-compiler, but even if I am correct, I would like to know more. Slow version: n=m=100; Timing[Do[Table[1,{i,1,n},{j,1,m}],{1000}];] Fast version: n=m=100; Timing[Do[Table[1,{i,1,n},Evaluate[{j,1,m}]],{1000}];] which is as fast as Timing[Do[Table[1,{i,1,100},{j,1,100}]],{1000}];] I also noticed that only the outermost iterator needs to be wrapped in Evaluate. Why(?) Thanks, Mariusz