Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Time-a-function/TorqueScript/time-a-function-1.torque
Normal file
23
Task/Time-a-function/TorqueScript/time-a-function-1.torque
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function benchmark(%times,%function,%a,%b,%c,%d,%e,%f,%g,%h,%i,%j,%k,%l,%m,%n,%o)
|
||||
{
|
||||
if(!isFunction(%function))
|
||||
{
|
||||
warn("BENCHMARKING RESULT FOR" SPC %function @ ":" NL "Function does not exist.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
%start = getRealTime();
|
||||
|
||||
for(%i=0; %i < %times; %i++)
|
||||
{
|
||||
call(%function,%a,%b,%c,%d,%e,%f,%g,%h,%i,%j,%k,%l,%m,%n,%o);
|
||||
}
|
||||
|
||||
%end = getRealTime();
|
||||
|
||||
%result = (%end-%start) / %times;
|
||||
|
||||
warn("BENCHMARKING RESULT FOR" SPC %function @ ":" NL %result);
|
||||
|
||||
return %result;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
function exampleFunction(%var1,%var2)
|
||||
{
|
||||
//put stuff here
|
||||
}
|
||||
|
||||
benchmark(500,"exampleFunction","blah","variables");
|
||||
|
||||
==> BENCHMARKING RESULT FOR exampleFunction:
|
||||
==> 13.257
|
||||
Loading…
Add table
Add a link
Reference in a new issue