Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active December 23, 2015 19:29
Show Gist options
  • Save tueda/6682667 to your computer and use it in GitHub Desktop.
Save tueda/6682667 to your computer and use it in GitHub Desktop.
Time[expr] evaluates the given expression with printing the timing of the evaluation in the real time.
(*
* Evaluates the given expression with printing the timing in the real time.
*)
Time[expr_] := Module[{t, r},
{t, r} = AbsoluteTiming[expr];
Print["Elapsed time: ", t, " seconds."];
r
];
SetAttributes[Time, HoldFirst];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment