Last active
December 23, 2015 19:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* 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