@flemist/test-variants 2.0.3 → 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,69 +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
|
-
|
|
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:
|
|
465
471
|
if(null==N?void 0:N.aborted)return[2,"continue"]
|
|
466
|
-
;if(
|
|
467
|
-
return
|
|
468
|
-
;case 4:
|
|
469
|
-
return
|
|
470
|
-
|
|
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(),
|
|
471
477
|
[2,"continue"]);case 6:
|
|
472
|
-
return
|
|
473
|
-
;case 7:
|
|
474
|
-
;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]
|
|
475
481
|
;case 9:return[3,13];case 10:
|
|
476
|
-
return
|
|
477
|
-
;case 11:
|
|
482
|
+
return vt.hold(1)?[3,12]:[4,vt.holdWait(1)]
|
|
483
|
+
;case 11:p.sent(),p.label=12;case 12:
|
|
478
484
|
c(r,void 0,void 0,function(){var r,s,i,o
|
|
479
485
|
;return l(this,function(c){switch(c.label){case 0:
|
|
480
486
|
return c.trys.push([0,3,6,7]),
|
|
481
|
-
(null==
|
|
487
|
+
(null==it?void 0:it.aborted)?[2]:g(r=t(n,e,it))?[4,r]:[3,2]
|
|
482
488
|
;case 1:r=c.sent(),c.label=2;case 2:
|
|
483
489
|
return r?(s=r.iterationsAsync,i=r.iterationsSync,
|
|
484
|
-
|
|
490
|
+
at+=s,lt+=i+s,[3,7]):(ct=!0,st.abort(),[2])
|
|
491
|
+
;case 3:
|
|
485
492
|
return o=c.sent(),P?[4,f(n,P,S.argsToJson)]:[3,5]
|
|
486
493
|
;case 4:c.sent(),c.label=5;case 5:if(!$)throw o
|
|
487
|
-
;return
|
|
488
|
-
;case 6:return
|
|
489
|
-
})}),
|
|
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
|
|
490
497
|
;case 1:
|
|
491
|
-
return(null==N?void 0:N.aborted)||!
|
|
498
|
+
return(null==N?void 0:N.aborted)||!ct&&!function(){
|
|
492
499
|
for(;;){
|
|
493
|
-
if($&&
|
|
494
|
-
variantIndex:
|
|
495
|
-
totalIndex:
|
|
496
|
-
;if(
|
|
497
|
-
;if(null==t||
|
|
498
|
-
;if(!n.done)return
|
|
499
|
-
variantIndex:
|
|
500
|
-
totalIndex:
|
|
501
|
-
if(!$)return!1
|
|
502
|
-
;
|
|
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()]
|
|
503
511
|
;case 2:return s.sent(),[3,1];case 3:
|
|
504
|
-
return
|
|
505
|
-
s.sent(),
|
|
506
|
-
if(null==
|
|
507
|
-
;return J&&console.log("[test-variants] variants: ".concat(
|
|
508
|
-
[4,Y(1)];case 6:return s.sent(),[2,
|
|
509
|
-
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
|
|
510
518
|
;return l(this,function(o){switch(o.label){case 0:
|
|
511
519
|
return S=n.saveErrorVariants,x=null!==(r=null==S?void 0:S.retriesPerVariant)&&void 0!==r?r:1,
|
|
512
520
|
E=new Date,
|
|
@@ -525,13 +533,13 @@ value:t&&t[r++],done:!t}}}
|
|
|
525
533
|
}(A),T=k.next(),o.label=3;case 3:
|
|
526
534
|
return T.done?[3,9]:[4,u(T.value,S.jsonToArgs)]
|
|
527
535
|
;case 4:z=o.sent(),O=0,o.label=5;case 5:
|
|
528
|
-
return O<x?g(
|
|
536
|
+
return O<x?g(F=t(z,-1,null))?[4,F]:[3,7]:[3,8]
|
|
529
537
|
;case 6:o.sent(),o.label=7;case 7:return O++,[3,5]
|
|
530
538
|
;case 8:return T=k.next(),[3,3];case 9:
|
|
531
|
-
return[3,12];case 10:return
|
|
539
|
+
return[3,12];case 10:return M=o.sent(),_t={error:M
|
|
532
540
|
},[3,12];case 11:try{
|
|
533
|
-
T&&!T.done&&(
|
|
534
|
-
if(
|
|
541
|
+
T&&!T.done&&(yt=k.return)&&yt.call(k)}finally{
|
|
542
|
+
if(_t)throw _t.error}return[7];case 12:
|
|
535
543
|
return D=null!==(v=n.GC_Iterations)&&void 0!==v?v:1e6,
|
|
536
544
|
C=null!==(_=n.GC_IterationsAsync)&&void 0!==_?_:1e4,
|
|
537
545
|
V=null!==(y=n.GC_Interval)&&void 0!==y?y:1e3,
|
|
@@ -539,21 +547,22 @@ R=null!==(b=n.logInterval)&&void 0!==b?b:5e3,
|
|
|
539
547
|
J=null===(p=n.logCompleted)||void 0===p||p,
|
|
540
548
|
N=n.abortSignal,$=n.findBestError,G=!0===n.parallel?Math.pow(2,31):!n.parallel||n.parallel<=0?1:n.parallel,
|
|
541
549
|
U=null!==(m=n.limitVariantsCount)&&void 0!==m?m:null,
|
|
542
|
-
W=
|
|
543
|
-
K={},
|
|
544
|
-
let e,n;function r(t){
|
|
545
|
-
for(let s=0;s<t.length;s++){
|
|
546
|
-
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
|
|
547
555
|
;n?(e||(e=new I,n.subscribe(r)),i.subscribe(r)):n=i
|
|
548
556
|
}}return e?e.signal:n||(new I).signal
|
|
549
|
-
}(N,
|
|
550
|
-
|
|
551
|
-
;case 13:return[2,{iterations:o.sent(),
|
|
552
|
-
}]}})})}
|
|
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){
|
|
553
562
|
return function(e){return function(n){
|
|
554
563
|
return c(this,void 0,void 0,function(){var r,s
|
|
555
|
-
;return l(this,function(i){return r=
|
|
564
|
+
;return l(this,function(i){return r=F(t,{
|
|
556
565
|
onError:null==n?void 0:n.onError}),s=d({
|
|
557
|
-
argsTemplates:e}),[2,
|
|
566
|
+
argsTemplates:e}),[2,tt(r,s,n)]})})}}
|
|
558
567
|
},t.generateErrorVariantFilePath=h,Object.defineProperty(t,"__esModule",{
|
|
559
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* () {
|
|
@@ -66,8 +78,12 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
66
78
|
? 1
|
|
67
79
|
: options.parallel;
|
|
68
80
|
const limitVariantsCount = (_j = options.limitVariantsCount) !== null && _j !== void 0 ? _j : null;
|
|
81
|
+
let prevCycleVariantsCount = null;
|
|
82
|
+
let prevCycleDuration = null;
|
|
69
83
|
let cycleIndex = 0;
|
|
70
84
|
let repeatIndex = 0;
|
|
85
|
+
const startTime = Date.now();
|
|
86
|
+
let cycleStartTime = startTime;
|
|
71
87
|
let seed = void 0;
|
|
72
88
|
let bestError = null;
|
|
73
89
|
let index = -1;
|
|
@@ -124,7 +140,10 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
124
140
|
if (!findBestError) {
|
|
125
141
|
return false;
|
|
126
142
|
}
|
|
143
|
+
prevCycleVariantsCount = index;
|
|
144
|
+
prevCycleDuration = Date.now() - cycleStartTime;
|
|
127
145
|
cycleIndex++;
|
|
146
|
+
cycleStartTime = Date.now();
|
|
128
147
|
if (cycleIndex >= findBestError.cycles) {
|
|
129
148
|
return false;
|
|
130
149
|
}
|
|
@@ -159,17 +178,39 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
159
178
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
160
179
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
161
180
|
let log = '';
|
|
181
|
+
const cycleElapsed = now - cycleStartTime;
|
|
182
|
+
const totalElapsed = now - startTime;
|
|
162
183
|
if (findBestError) {
|
|
163
184
|
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
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;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
estimatedCycleTime = cycleElapsed * max / index;
|
|
203
|
+
}
|
|
204
|
+
log += `/${max} (${formatDuration(cycleElapsed)}/${formatDuration(estimatedCycleTime)})`;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
log += ` (${formatDuration(cycleElapsed)})`;
|
|
167
208
|
}
|
|
168
209
|
}
|
|
169
210
|
else {
|
|
170
|
-
log += `variant: ${index}`;
|
|
211
|
+
log += `variant: ${index} (${formatDuration(cycleElapsed)})`;
|
|
171
212
|
}
|
|
172
|
-
log += `, total: ${iterations}`;
|
|
213
|
+
log += `, total: ${iterations} (${formatDuration(totalElapsed)})`;
|
|
173
214
|
console.log(log);
|
|
174
215
|
prevLogTime = now;
|
|
175
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* () {
|
|
@@ -42,8 +54,12 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
42
54
|
? 1
|
|
43
55
|
: options.parallel;
|
|
44
56
|
const limitVariantsCount = (_j = options.limitVariantsCount) !== null && _j !== void 0 ? _j : null;
|
|
57
|
+
let prevCycleVariantsCount = null;
|
|
58
|
+
let prevCycleDuration = null;
|
|
45
59
|
let cycleIndex = 0;
|
|
46
60
|
let repeatIndex = 0;
|
|
61
|
+
const startTime = Date.now();
|
|
62
|
+
let cycleStartTime = startTime;
|
|
47
63
|
let seed = void 0;
|
|
48
64
|
let bestError = null;
|
|
49
65
|
let index = -1;
|
|
@@ -100,7 +116,10 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
100
116
|
if (!findBestError) {
|
|
101
117
|
return false;
|
|
102
118
|
}
|
|
119
|
+
prevCycleVariantsCount = index;
|
|
120
|
+
prevCycleDuration = Date.now() - cycleStartTime;
|
|
103
121
|
cycleIndex++;
|
|
122
|
+
cycleStartTime = Date.now();
|
|
104
123
|
if (cycleIndex >= findBestError.cycles) {
|
|
105
124
|
return false;
|
|
106
125
|
}
|
|
@@ -135,17 +154,39 @@ function testVariantsRun(testRun, variants, options = {}) {
|
|
|
135
154
|
if (logInterval && now - prevLogTime >= logInterval) {
|
|
136
155
|
// the log is required to prevent the karma browserNoActivityTimeout
|
|
137
156
|
let log = '';
|
|
157
|
+
const cycleElapsed = now - cycleStartTime;
|
|
158
|
+
const totalElapsed = now - startTime;
|
|
138
159
|
if (findBestError) {
|
|
139
160
|
log += `cycle: ${cycleIndex}, variant: ${index}`;
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
|
|
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;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
estimatedCycleTime = cycleElapsed * max / index;
|
|
179
|
+
}
|
|
180
|
+
log += `/${max} (${formatDuration(cycleElapsed)}/${formatDuration(estimatedCycleTime)})`;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
log += ` (${formatDuration(cycleElapsed)})`;
|
|
143
184
|
}
|
|
144
185
|
}
|
|
145
186
|
else {
|
|
146
|
-
log += `variant: ${index}`;
|
|
187
|
+
log += `variant: ${index} (${formatDuration(cycleElapsed)})`;
|
|
147
188
|
}
|
|
148
|
-
log += `, total: ${iterations}`;
|
|
189
|
+
log += `, total: ${iterations} (${formatDuration(totalElapsed)})`;
|
|
149
190
|
console.log(log);
|
|
150
191
|
prevLogTime = now;
|
|
151
192
|
}
|