Time a function: Difference between revisions

Logo, using the shell
(Logo, using the shell)
Line 336:
Done!
Counting to 1000000000 takes 3391ms</pre>
 
=={{header|Logo}}==
{{works with|UCB Logo}} on a Unix system
 
This is not an ideal method; Logo does not expose a timer (except for the WAIT command) so we use the Unix "date" command to get a second timer.
 
<lang logo>to time
output first first shell "|date +%s|
end
to elapsed :block
localmake "start time
run :block
(print time - :start [seconds elapsed])
end
 
elapsed [wait 300] ; 5 seconds elapsed</lang>
 
=={{header|Mathematica}}==
Anonymous user