Time a function: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (→‎{{header|RPL}}: formatting + note)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(One intermediate revision by one other user not shown)
Line 1,155:
=={{header|Elena}}==
{{trans|C#}}
ELENA 46.x :
<syntaxhighlight lang="elena">import system'calendar;
import system'routines;
Line 1,166:
threadControl.sleep(1000);
new Range(0,10000).filterBy::(x => x.mod:(2) == 0).summarize();
}
Line 3,079:
{{libheader|Wren-check}}
The only way Wren currently has to time a function (encapsulated in the ''Benchmark.run'' method) is to measure the System time before and after the function is called. We therefore use that approach, averaging over say 100 runs, having first shut down as many other processes as we can.
<syntaxhighlight lang="ecmascriptwren">import "./check" for Benchmark
 
Benchmark.run("a function", 100, true) {
9,482

edits