quick_bench$STAR_ function
dynamic
quick_bench$STAR_(
- dynamic run$1
Implementation
dc.dynamic quick_bench$STAR_(dc.dynamic run$1, ){
final dc.Stopwatch sw$1=dc.Stopwatch();
final void $UNDERSCORE_$1=dc.print("Calibrating", );
late final dc.dynamic n$2;
dc.dynamic n$1=1;
do {
final dc.Stopwatch G$8875_$1=sw$1;
G$8875_$1.reset();
G$8875_$1.start();
if((run$1 is dc.Function)){
(run$1 as dc.Function)(n$1, );
}else if((run$1 is lcoc_core.IFn$iface)){
(run$1 as lcoc_core.IFn$iface).$_invoke$1(n$1, );
}else{
lcoc_core.IFn.extensions(run$1, ).$_invoke$1(run$1, n$1, );
}
sw$1.stop();
if((sw$1.elapsedMicroseconds<100000)){
n$1=(2*(n$1 as dc.num));
continue;
}else{
n$2=n$1;
}
break;
} while(true);
dc.print((lcoc_core.str.$_invoke$3("Running (batch size: ", n$2, ")", )), );
dc.dynamic cnt$1=0;
dc.dynamic mean$1=0.0;
dc.dynamic m2$1=0.0;
dc.dynamic rem$1=(((2*60)*1000)*1000);
do {
final dc.Stopwatch G$8876_$1=sw$1;
G$8876_$1.reset();
G$8876_$1.start();
if((run$1 is dc.Function)){
(run$1 as dc.Function)(n$2, );
}else if((run$1 is lcoc_core.IFn$iface)){
(run$1 as lcoc_core.IFn$iface).$_invoke$1(n$2, );
}else{
lcoc_core.IFn.extensions(run$1, ).$_invoke$1(run$1, n$2, );
}
sw$1.stop();
final dc.int t$1=sw$1.elapsedMicroseconds;
final dc.num rem$2=((rem$1 as dc.num)-t$1);
final dc.num cnt$2=(1+(cnt$1 as dc.num));
final dc.num delta$1=(t$1-(mean$1 as dc.num));
final dc.num mean$2=((mean$1 as dc.num)+(delta$1/cnt$2));
final dc.num delta$PRIME_$1=(t$1-mean$2);
final dc.num m2$2=((m2$1 as dc.num)+(delta$1*delta$PRIME_$1));
final dc.bool or$7508_$AUTO_$1=(0<rem$2);
late final dc.bool $if_$1;
if(or$7508_$AUTO_$1){
$if_$1=or$7508_$AUTO_$1;
}else{
$if_$1=(cnt$2<2);
}
if($if_$1){
cnt$1=cnt$2;
mean$1=mean$2;
m2$1=m2$2;
rem$1=rem$2;
continue;
}
final dc.double sd$1=d_math.sqrt((m2$2/(cnt$2-1)), );
return dc.print((lcoc_core.str.$_invoke$4((mean$2/(n$2 as dc.num)), " (+/-", (sd$1/(n$2 as dc.num)), ") us", )), );
} while(true);
}