RosettaCodeData/Task/Rate-counter/Mathematica/rate-counter.math

5 lines
229 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
jobRateCounted[fn_,Y_Integer]:=First[AbsoluteTiming[Do[fn,{Y}]]/Y;
SetAttributes[jobRateCounted,HoldFirst]
jobRatePeriod[fn_,time_]:=Block[{n=0},TimeConstrained[While[True,fn;n++]];n/time];
SetAttributes[jobRatePeriod,HoldFirst]