@flemist/test-variants 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle/browser.js
CHANGED
|
@@ -233,7 +233,7 @@ throwIfAborted(){if(this.aborted)throw this.reason
|
|
|
233
233
|
}}class I{constructor(){this.signal=new O}
|
|
234
234
|
abort(t){
|
|
235
235
|
this.signal.aborted||(void 0===t&&((t=new T("Aborted with no reason",t))._internal=!0),
|
|
236
|
-
this.signal.abort(t))}}function
|
|
236
|
+
this.signal.abort(t))}}function F(t,e){
|
|
237
237
|
var n=0,r=null;function s(t,s,i){
|
|
238
238
|
return c(this,void 0,void 0,function(){var o
|
|
239
239
|
;return l(this,function(c){switch(c.label){case 0:
|
|
@@ -254,7 +254,7 @@ return s(t,e,n)});return"number"==typeof i?{
|
|
|
254
254
|
iterationsAsync:0,iterationsSync:i
|
|
255
255
|
}:null!==i&&"object"==typeof i?i:{
|
|
256
256
|
iterationsAsync:0,iterationsSync:1}}catch(t){
|
|
257
|
-
return s(t,e,n)}}}class
|
|
257
|
+
return s(t,e,n)}}}class M{constructor(t,e){
|
|
258
258
|
this._branch=null,this.order=t,this.parent=e}
|
|
259
259
|
get branch(){if(!this._branch){
|
|
260
260
|
const t=[this.order];let e=this.parent
|
|
@@ -388,7 +388,7 @@ constructor(){this._queue=new _({lessThanFunc:L})}
|
|
|
388
388
|
run(t,e,n){return this._run(!1,t,e,n)}
|
|
389
389
|
runTask(t,e,n){return this._run(!0,t,e,n)}
|
|
390
390
|
_run(t,e,n,r){const s=new W(r),i={
|
|
391
|
-
priority:(o=Q++,c=n,null==o?null==c?null:c:new
|
|
391
|
+
priority:(o=Q++,c=n,null==o?null==c?null:c:new M(o,c)),
|
|
392
392
|
func:e,abortSignal:r,resolve:s.resolve,
|
|
393
393
|
reject:s.reject,readyToRun:!t};var o,c
|
|
394
394
|
;if(this._queue.add(i),t){const t=this;return{
|
|
@@ -444,71 +444,77 @@ for(;t>this._size;)yield this.tick(n),yield r(e,n)
|
|
|
444
444
|
if(null==t||t<=0)throw new Error("Iterations = ".concat(t))
|
|
445
445
|
;t--;var e=new Promise(function(e){
|
|
446
446
|
setTimeout(function(){e(t)},1)})
|
|
447
|
-
;return t<=0?e:e.then(Y)}function Z(t
|
|
448
|
-
|
|
447
|
+
;return t<=0?e:e.then(Y)}function Z(t){var e=t/1e3
|
|
448
|
+
;if(e<60)return"".concat(e.toFixed(1),"s")
|
|
449
|
+
;var n=e/60
|
|
450
|
+
;return n<60?"".concat(n.toFixed(1),"m"):"".concat((n/60).toFixed(1),"h")
|
|
451
|
+
}function tt(t,e,n){var r,s,d,v,_,y,b,p,m
|
|
449
452
|
;return void 0===n&&(n={}),c(this,void 0,void 0,function(){
|
|
450
453
|
function w(){
|
|
451
|
-
return null!=U&&null!=
|
|
454
|
+
return null!=U&&null!=tt?Math.min(U,tt.index):null!=U?U:null!=tt?tt.index:null
|
|
452
455
|
}function j(){
|
|
453
456
|
return c(this,void 0,void 0,function(){
|
|
454
457
|
var n,r=this;return l(this,function(s){
|
|
455
458
|
switch(s.label){case 0:n=function(){
|
|
456
|
-
var e,n,s,i,a,u,h,d,v
|
|
457
|
-
switch(
|
|
458
|
-
seed:
|
|
459
|
-
}),s=(R||V)&&Date.now(),R&&s-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
var e,n,s,i,a,u,h,d,v,_,y,b
|
|
460
|
+
;return l(this,function(p){switch(p.label){case 0:
|
|
461
|
+
return e=et,n=o(o({},nt),{seed:H
|
|
462
|
+
}),s=(R||V)&&Date.now(),R&&s-ut>=R&&(i="",a=s-K,
|
|
463
|
+
u=s-Q,$?(i+="cycle: ".concat(B,", variant: ").concat(et),
|
|
464
|
+
null!=(h=w())&&null!=W&&W<h&&(h=W),
|
|
465
|
+
null!=h&&et>0?(d=void 0,d=null!=q&&null!=W&&et<W&&a<q?a+(h-et)*((q-a)/(W-et)):a*h/et,
|
|
466
|
+
i+="/".concat(h," (").concat(Z(a),"/").concat(Z(d),")")):i+=" (".concat(Z(a),")")):i+="variant: ".concat(et," (").concat(Z(a),")"),
|
|
467
|
+
i+=", total: ".concat(lt," (").concat(Z(u),")"),
|
|
468
|
+
console.log(i),ut=s),D&<-ft>=D||C&&at-dt>=C||V&&s-ht>=V?(ft=lt,
|
|
469
|
+
dt=at,ht=s,[4,Y(1)]):[3,2];case 1:
|
|
470
|
+
p.sent(),p.label=2;case 2:
|
|
466
471
|
if(null==N?void 0:N.aborted)return[2,"continue"]
|
|
467
|
-
;if(
|
|
468
|
-
return
|
|
469
|
-
;case 4:
|
|
470
|
-
return
|
|
471
|
-
|
|
472
|
+
;if(vt&&!it.aborted)return[3,10];p.label=3;case 3:
|
|
473
|
+
return p.trys.push([3,6,,9]),g(v=t(n,e,it))?[4,v]:[3,5]
|
|
474
|
+
;case 4:v=p.sent(),p.label=5;case 5:
|
|
475
|
+
return v?(_=v.iterationsAsync,y=v.iterationsSync,
|
|
476
|
+
at+=_,lt+=y+_,[3,9]):(ct=!0,st.abort(),
|
|
472
477
|
[2,"continue"]);case 6:
|
|
473
|
-
return
|
|
474
|
-
;case 7:
|
|
475
|
-
;return
|
|
478
|
+
return b=p.sent(),P?[4,f(n,P,S.argsToJson)]:[3,8]
|
|
479
|
+
;case 7:p.sent(),p.label=8;case 8:if(!$)throw b
|
|
480
|
+
;return tt={error:b,args:n,index:e},ct=!1,[3,9]
|
|
476
481
|
;case 9:return[3,13];case 10:
|
|
477
|
-
return
|
|
478
|
-
;case 11:
|
|
482
|
+
return vt.hold(1)?[3,12]:[4,vt.holdWait(1)]
|
|
483
|
+
;case 11:p.sent(),p.label=12;case 12:
|
|
479
484
|
c(r,void 0,void 0,function(){var r,s,i,o
|
|
480
485
|
;return l(this,function(c){switch(c.label){case 0:
|
|
481
486
|
return c.trys.push([0,3,6,7]),
|
|
482
|
-
(null==
|
|
487
|
+
(null==it?void 0:it.aborted)?[2]:g(r=t(n,e,it))?[4,r]:[3,2]
|
|
483
488
|
;case 1:r=c.sent(),c.label=2;case 2:
|
|
484
489
|
return r?(s=r.iterationsAsync,i=r.iterationsSync,
|
|
485
|
-
|
|
490
|
+
at+=s,lt+=i+s,[3,7]):(ct=!0,st.abort(),[2])
|
|
486
491
|
;case 3:
|
|
487
492
|
return o=c.sent(),P?[4,f(n,P,S.argsToJson)]:[3,5]
|
|
488
493
|
;case 4:c.sent(),c.label=5;case 5:if(!$)throw o
|
|
489
|
-
;return
|
|
490
|
-
;case 6:return
|
|
491
|
-
})}),
|
|
494
|
+
;return tt={error:o,args:n,index:e},ct=!1,[3,7]
|
|
495
|
+
;case 6:return vt.release(1),[7];case 7:return[2]}
|
|
496
|
+
})}),p.label=13;case 13:return[2]}})},s.label=1
|
|
492
497
|
;case 1:
|
|
493
|
-
return(null==N?void 0:N.aborted)||!
|
|
498
|
+
return(null==N?void 0:N.aborted)||!ct&&!function(){
|
|
494
499
|
for(;;){
|
|
495
|
-
if($&&
|
|
496
|
-
variantIndex:
|
|
497
|
-
totalIndex:
|
|
498
|
-
;if(
|
|
499
|
-
;if(null==t||
|
|
500
|
-
;if(!n.done)return
|
|
501
|
-
variantIndex:
|
|
502
|
-
totalIndex:
|
|
503
|
-
if(!$)return!1
|
|
504
|
-
;
|
|
500
|
+
if($&&et>=0&&(null==tt||et<tt.index)&&++L<$.repeatsPerVariant)return H=$.getSeed({
|
|
501
|
+
variantIndex:et,cycleIndex:B,repeatIndex:L,
|
|
502
|
+
totalIndex:B*$.repeatsPerVariant+L}),!0
|
|
503
|
+
;if(L=0,et++,$&&B>=$.cycles)return!1;var t=w()
|
|
504
|
+
;if(null==t||et<t){var n=rt.next()
|
|
505
|
+
;if(!n.done)return nt=n.value,$&&(H=$.getSeed({
|
|
506
|
+
variantIndex:et,cycleIndex:B,repeatIndex:L,
|
|
507
|
+
totalIndex:B*$.repeatsPerVariant+L})),!0}
|
|
508
|
+
if(!$)return!1
|
|
509
|
+
;if(W=et,q=Date.now()-K,B++,K=Date.now(),B>=$.cycles)return!1
|
|
510
|
+
;et=-1,rt=e[Symbol.iterator]()}}()?[3,3]:[5,n()]
|
|
505
511
|
;case 2:return s.sent(),[3,1];case 3:
|
|
506
|
-
return
|
|
507
|
-
s.sent(),
|
|
508
|
-
if(null==
|
|
509
|
-
;return J&&console.log("[test-variants] variants: ".concat(
|
|
510
|
-
[4,Y(1)];case 6:return s.sent(),[2,
|
|
511
|
-
var S,x,E,P,A,k,T,z,O,M,
|
|
512
|
+
return vt?[4,vt.holdWait(G)]:[3,5];case 4:
|
|
513
|
+
s.sent(),vt.release(G),s.label=5;case 5:
|
|
514
|
+
if(null==ot?void 0:ot.aborted)throw ot.reason
|
|
515
|
+
;return J&&console.log("[test-variants] variants: ".concat(et,", iterations: ").concat(lt,", async: ").concat(at)),
|
|
516
|
+
[4,Y(1)];case 6:return s.sent(),[2,lt]}})})}
|
|
517
|
+
var S,x,E,P,A,k,T,z,O,F,M,D,C,V,R,J,N,$,G,U,W,q,B,L,Q,K,H,tt,et,nt,rt,st,it,ot,ct,lt,at,ut,ht,ft,dt,vt,_t,yt
|
|
512
518
|
;return l(this,function(o){switch(o.label){case 0:
|
|
513
519
|
return S=n.saveErrorVariants,x=null!==(r=null==S?void 0:S.retriesPerVariant)&&void 0!==r?r:1,
|
|
514
520
|
E=new Date,
|
|
@@ -527,13 +533,13 @@ value:t&&t[r++],done:!t}}}
|
|
|
527
533
|
}(A),T=k.next(),o.label=3;case 3:
|
|
528
534
|
return T.done?[3,9]:[4,u(T.value,S.jsonToArgs)]
|
|
529
535
|
;case 4:z=o.sent(),O=0,o.label=5;case 5:
|
|
530
|
-
return O<x?g(
|
|
536
|
+
return O<x?g(F=t(z,-1,null))?[4,F]:[3,7]:[3,8]
|
|
531
537
|
;case 6:o.sent(),o.label=7;case 7:return O++,[3,5]
|
|
532
538
|
;case 8:return T=k.next(),[3,3];case 9:
|
|
533
|
-
return[3,12];case 10:return
|
|
539
|
+
return[3,12];case 10:return M=o.sent(),_t={error:M
|
|
534
540
|
},[3,12];case 11:try{
|
|
535
|
-
T&&!T.done&&(
|
|
536
|
-
if(
|
|
541
|
+
T&&!T.done&&(yt=k.return)&&yt.call(k)}finally{
|
|
542
|
+
if(_t)throw _t.error}return[7];case 12:
|
|
537
543
|
return D=null!==(v=n.GC_Iterations)&&void 0!==v?v:1e6,
|
|
538
544
|
C=null!==(_=n.GC_IterationsAsync)&&void 0!==_?_:1e4,
|
|
539
545
|
V=null!==(y=n.GC_Interval)&&void 0!==y?y:1e3,
|
|
@@ -541,21 +547,22 @@ R=null!==(b=n.logInterval)&&void 0!==b?b:5e3,
|
|
|
541
547
|
J=null===(p=n.logCompleted)||void 0===p||p,
|
|
542
548
|
N=n.abortSignal,$=n.findBestError,G=!0===n.parallel?Math.pow(2,31):!n.parallel||n.parallel<=0?1:n.parallel,
|
|
543
549
|
U=null!==(m=n.limitVariantsCount)&&void 0!==m?m:null,
|
|
544
|
-
W=null,q=
|
|
545
|
-
K=-1,
|
|
546
|
-
let e,n;function r(t){
|
|
547
|
-
for(let s=0;s<t.length;s++){
|
|
548
|
-
if(i.aborted)return i
|
|
550
|
+
W=null,q=null,B=0,L=0,Q=Date.now(),
|
|
551
|
+
K=Q,H=void 0,tt=null,et=-1,nt={},rt=e[Symbol.iterator](),
|
|
552
|
+
st=new I,it=function(...t){let e,n;function r(t){
|
|
553
|
+
e.abort(t)}for(let s=0;s<t.length;s++){
|
|
554
|
+
const i=t[s];if(i){if(i.aborted)return i
|
|
549
555
|
;n?(e||(e=new I,n.subscribe(r)),i.subscribe(r)):n=i
|
|
550
556
|
}}return e?e.signal:n||(new I).signal
|
|
551
|
-
}(N,
|
|
552
|
-
|
|
553
|
-
;case 13:return[2,{iterations:o.sent(),
|
|
554
|
-
}]}})})}
|
|
557
|
+
}(N,st.signal),ot=it,ct=!1,lt=0,at=0,ut=Date.now(),
|
|
558
|
+
ht=ut,ft=lt,dt=at,vt=G<=1?null:new X(G),[4,j()]
|
|
559
|
+
;case 13:return[2,{iterations:o.sent(),
|
|
560
|
+
bestError:tt}]}})})}
|
|
561
|
+
t.createTestVariants=function(t){
|
|
555
562
|
return function(e){return function(n){
|
|
556
563
|
return c(this,void 0,void 0,function(){var r,s
|
|
557
|
-
;return l(this,function(i){return r=
|
|
564
|
+
;return l(this,function(i){return r=F(t,{
|
|
558
565
|
onError:null==n?void 0:n.onError}),s=d({
|
|
559
|
-
argsTemplates:e}),[2,
|
|
566
|
+
argsTemplates:e}),[2,tt(r,s,n)]})})}}
|
|
560
567
|
},t.generateErrorVariantFilePath=h,Object.defineProperty(t,"__esModule",{
|
|
561
568
|
value:!0})}({},fs,path);
|
|
@@ -31,6 +31,18 @@ function _interopNamespace(e) {
|
|
|
31
31
|
|
|
32
32
|
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
33
33
|
|
|
34
|
+
function formatDuration(ms) {
|
|
35
|
+
const seconds = ms / 1000;
|
|
36
|
+
if (seconds < 60) {
|
|
37
|
+
return `${seconds.toFixed(1)}s`;
|
|
38
|
+
}
|
|
39
|
+
const minutes = seconds / 60;
|
|
40
|
+
if (minutes < 60) {
|
|
41
|
+
return `${minutes.toFixed(1)}m`;
|
|
42
|
+
}
|
|
43
|
+
const hours = minutes / 60;
|
|
44
|
+
return `${hours.toFixed(1)}h`;
|
|
45
|
+
}
|
|
34
46
|
function testVariantsRun(testRun, variants, options = {}) {
|
|
35
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
48
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,8 +79,11 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
67
79
|
: options.parallel;
|
|
68
80
|
const limitVariantsCount = (_j = options.limitVariantsCount) !== null && _j !== void 0 ? _j : null;
|
|
69
81
|
let prevCycleVariantsCount = null;
|
|
82
|
+
let prevCycleDuration = null;
|
|
70
83
|
let cycleIndex = 0;
|
|
71
84
|
let repeatIndex = 0;
|
|
85
|
+
const startTime = Date.now();
|
|
86
|
+
let cycleStartTime = startTime;
|
|
72
87
|
let seed = void 0;
|
|
73
88
|
let bestError = null;
|
|
74
89
|
let index = -1;
|
|
@@ -126,7 +141,9 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
126
141
|
return false;
|
|
127
142
|
}
|
|
128
143
|
prevCycleVariantsCount = index;
|
|
144
|
+
prevCycleDuration = Date.now() - cycleStartTime;
|
|
129
145
|
cycleIndex++;
|
|
146
|
+
cycleStartTime = Date.now();
|
|
130
147
|
if (cycleIndex >= findBestError.cycles) {
|
|
131
148
|
return false;
|
|
132
149
|
}
|
|
@@ -161,22 +178,39 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
161
178
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
162
179
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
163
180
|
let log = '';
|
|
181
|
+
const cycleElapsed = now - cycleStartTime;
|
|
182
|
+
const totalElapsed = now - startTime;
|
|
164
183
|
if (findBestError) {
|
|
165
184
|
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
185
|
+
let max = getLimitVariantsCount();
|
|
186
|
+
if (max != null) {
|
|
187
|
+
if (prevCycleVariantsCount != null && prevCycleVariantsCount < max) {
|
|
188
|
+
max = prevCycleVariantsCount;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (max != null && index > 0) {
|
|
192
|
+
let estimatedCycleTime;
|
|
193
|
+
if (prevCycleDuration != null && prevCycleVariantsCount != null
|
|
194
|
+
&& index < prevCycleVariantsCount && cycleElapsed < prevCycleDuration) {
|
|
195
|
+
const adjustedDuration = prevCycleDuration - cycleElapsed;
|
|
196
|
+
const adjustedCount = prevCycleVariantsCount - index;
|
|
197
|
+
const speedForRemaining = adjustedDuration / adjustedCount;
|
|
198
|
+
const remainingTime = (max - index) * speedForRemaining;
|
|
199
|
+
estimatedCycleTime = cycleElapsed + remainingTime;
|
|
173
200
|
}
|
|
201
|
+
else {
|
|
202
|
+
estimatedCycleTime = cycleElapsed * max / index;
|
|
203
|
+
}
|
|
204
|
+
log += `/${max} (${formatDuration(cycleElapsed)}/${formatDuration(estimatedCycleTime)})`;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
log += ` (${formatDuration(cycleElapsed)})`;
|
|
174
208
|
}
|
|
175
209
|
}
|
|
176
210
|
else {
|
|
177
|
-
log += `variant: ${index}`;
|
|
211
|
+
log += `variant: ${index} (${formatDuration(cycleElapsed)})`;
|
|
178
212
|
}
|
|
179
|
-
log += `, total: ${iterations}`;
|
|
213
|
+
log += `, total: ${iterations} (${formatDuration(totalElapsed)})`;
|
|
180
214
|
console.log(log);
|
|
181
215
|
prevLogTime = now;
|
|
182
216
|
}
|
|
@@ -7,6 +7,18 @@ import { generateErrorVariantFilePath, readErrorVariantFiles, parseErrorVariantF
|
|
|
7
7
|
import * as path from 'path';
|
|
8
8
|
import 'fs';
|
|
9
9
|
|
|
10
|
+
function formatDuration(ms) {
|
|
11
|
+
const seconds = ms / 1000;
|
|
12
|
+
if (seconds < 60) {
|
|
13
|
+
return `${seconds.toFixed(1)}s`;
|
|
14
|
+
}
|
|
15
|
+
const minutes = seconds / 60;
|
|
16
|
+
if (minutes < 60) {
|
|
17
|
+
return `${minutes.toFixed(1)}m`;
|
|
18
|
+
}
|
|
19
|
+
const hours = minutes / 60;
|
|
20
|
+
return `${hours.toFixed(1)}h`;
|
|
21
|
+
}
|
|
10
22
|
function testVariantsRun(testRun, variants, options = {}) {
|
|
11
23
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
12
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -43,8 +55,11 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
43
55
|
: options.parallel;
|
|
44
56
|
const limitVariantsCount = (_j = options.limitVariantsCount) !== null && _j !== void 0 ? _j : null;
|
|
45
57
|
let prevCycleVariantsCount = null;
|
|
58
|
+
let prevCycleDuration = null;
|
|
46
59
|
let cycleIndex = 0;
|
|
47
60
|
let repeatIndex = 0;
|
|
61
|
+
const startTime = Date.now();
|
|
62
|
+
let cycleStartTime = startTime;
|
|
48
63
|
let seed = void 0;
|
|
49
64
|
let bestError = null;
|
|
50
65
|
let index = -1;
|
|
@@ -102,7 +117,9 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
102
117
|
return false;
|
|
103
118
|
}
|
|
104
119
|
prevCycleVariantsCount = index;
|
|
120
|
+
prevCycleDuration = Date.now() - cycleStartTime;
|
|
105
121
|
cycleIndex++;
|
|
122
|
+
cycleStartTime = Date.now();
|
|
106
123
|
if (cycleIndex >= findBestError.cycles) {
|
|
107
124
|
return false;
|
|
108
125
|
}
|
|
@@ -137,22 +154,39 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
137
154
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
138
155
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
139
156
|
let log = '';
|
|
157
|
+
const cycleElapsed = now - cycleStartTime;
|
|
158
|
+
const totalElapsed = now - startTime;
|
|
140
159
|
if (findBestError) {
|
|
141
160
|
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
let max = getLimitVariantsCount();
|
|
162
|
+
if (max != null) {
|
|
163
|
+
if (prevCycleVariantsCount != null && prevCycleVariantsCount < max) {
|
|
164
|
+
max = prevCycleVariantsCount;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (max != null && index > 0) {
|
|
168
|
+
let estimatedCycleTime;
|
|
169
|
+
if (prevCycleDuration != null && prevCycleVariantsCount != null
|
|
170
|
+
&& index < prevCycleVariantsCount && cycleElapsed < prevCycleDuration) {
|
|
171
|
+
const adjustedDuration = prevCycleDuration - cycleElapsed;
|
|
172
|
+
const adjustedCount = prevCycleVariantsCount - index;
|
|
173
|
+
const speedForRemaining = adjustedDuration / adjustedCount;
|
|
174
|
+
const remainingTime = (max - index) * speedForRemaining;
|
|
175
|
+
estimatedCycleTime = cycleElapsed + remainingTime;
|
|
149
176
|
}
|
|
177
|
+
else {
|
|
178
|
+
estimatedCycleTime = cycleElapsed * max / index;
|
|
179
|
+
}
|
|
180
|
+
log += `/${max} (${formatDuration(cycleElapsed)}/${formatDuration(estimatedCycleTime)})`;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
log += ` (${formatDuration(cycleElapsed)})`;
|
|
150
184
|
}
|
|
151
185
|
}
|
|
152
186
|
else {
|
|
153
|
-
log += `variant: ${index}`;
|
|
187
|
+
log += `variant: ${index} (${formatDuration(cycleElapsed)})`;
|
|
154
188
|
}
|
|
155
|
-
log += `, total: ${iterations}`;
|
|
189
|
+
log += `, total: ${iterations} (${formatDuration(totalElapsed)})`;
|
|
156
190
|
console.log(log);
|
|
157
191
|
prevLogTime = now;
|
|
158
192
|
}
|