Skip to content

Commit 791c39e

Browse files
😒 chore(dev-deps): Upgrade xo.
1 parent 31ebe97 commit 791c39e

File tree

7 files changed

+312
-432
lines changed

7 files changed

+312
-432
lines changed

_benchmark/benchmark.js

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@ const Benchmark = require('benchmark');
3737
// PUSH
3838

3939
const PUSH = new Benchmark.Suite()
40-
.on('start', function () {
40+
.on('start', () => {
4141
console.log('\nPUSH\n==\n');
4242
})
43-
.add('Array#push', function () {
43+
.add('Array#push', () => {
4444
const a = [];
4545
const _M = M;
4646
for (let i = 0; i < _M; ++i) a.push(i);
4747
})
48-
.add('fingertree#addLast', function () {
48+
.add('fingertree#addLast', () => {
4949
let t = fromArray([]);
5050
const _M = M;
5151
for (let i = 0; i < _M; ++i) t = t.addLast(i);
5252
})
53-
.add('@aureooms/js-fingertree#push', function () {
53+
.add('@aureooms/js-fingertree#push', () => {
5454
let t = empty(COUNTER);
5555
const _M = M;
5656
for (let i = 0; i < _M; ++i) t = t.push(i);
5757
});
5858

5959
if (M <= 1000)
60-
PUSH.add('Mock#push', function () {
60+
PUSH.add('Mock#push', () => {
6161
let m = [];
6262
const _M = M;
6363
for (let i = 0; i < _M; ++i) m = m.concat([i]);
6464
});
6565

66-
PUSH.on('cycle', function (event) {
66+
PUSH.on('cycle', (event) => {
6767
console.log(String(event.target));
6868
})
6969
.on('complete', function () {
@@ -73,34 +73,34 @@ PUSH.on('cycle', function (event) {
7373

7474
// CONS
7575

76-
const CONS = new Benchmark.Suite().on('start', function () {
76+
const CONS = new Benchmark.Suite().on('start', () => {
7777
console.log('\nCONS\n==\n');
7878
});
7979

8080
if (M <= 10000)
81-
CONS.add('Array#unshift', function () {
81+
CONS.add('Array#unshift', () => {
8282
const a = [];
8383
const _M = M;
8484
for (let i = 0; i < _M; ++i) a.unshift(i);
8585
});
8686

87-
CONS.add('fingertree#addFirst', function () {
87+
CONS.add('fingertree#addFirst', () => {
8888
let t = fromArray([]);
8989
const _M = M;
9090
for (let i = 0; i < _M; ++i) t = t.addFirst(i);
91-
}).add('@aureooms/js-fingertree#cons', function () {
91+
}).add('@aureooms/js-fingertree#cons', () => {
9292
let t = empty(COUNTER);
9393
const _M = M;
9494
for (let i = 0; i < _M; ++i) t = t.cons(i);
9595
});
9696
if (M <= 1000)
97-
CONS.add('Mock#cons', function () {
97+
CONS.add('Mock#cons', () => {
9898
let m = [];
9999
const _M = M;
100100
for (let i = 0; i < _M; ++i) m = [i].concat(m);
101101
});
102102

103-
CONS.on('cycle', function (event) {
103+
CONS.on('cycle', (event) => {
104104
console.log(String(event.target));
105105
})
106106
.on('complete', function () {
@@ -122,28 +122,28 @@ const setup = function () {
122122
};
123123

124124
const INIT = new Benchmark.Suite()
125-
.on('start', function () {
125+
.on('start', () => {
126126
console.log('\nINIT\n==\n');
127127
})
128128
.add(
129129
'Array#pop',
130-
function () {
130+
() => {
131131
const _a = a.slice();
132132
for (let i = 0; i < _M; ++i) _a.pop();
133133
},
134134
{setup}
135135
)
136136
.add(
137137
'fingertree#removeLast',
138-
function () {
138+
() => {
139139
let _t = qt;
140140
for (let i = 0; i < _M; ++i) _t = _t.removeLast();
141141
},
142142
{setup}
143143
)
144144
.add(
145145
'@aureooms/js-fingertree#init',
146-
function () {
146+
() => {
147147
let _t = at;
148148
for (let i = 0; i < _M; ++i) _t = _t.init();
149149
},
@@ -153,17 +153,17 @@ const INIT = new Benchmark.Suite()
153153
if (M <= 1000)
154154
INIT.add(
155155
'Mock#init',
156-
function () {
156+
() => {
157157
let _m = a;
158158
for (let i = 0; i < _M; ++i) _m = _m.slice(0, -1);
159159
},
160160
{setup}
161161
);
162162

163-
INIT.on('cycle', function (event) {
163+
INIT.on('cycle', (event) => {
164164
console.log(String(event.target));
165165
})
166-
.on('error', function (event) {
166+
.on('error', (event) => {
167167
console.dir(event);
168168
})
169169
.on('complete', function () {
@@ -173,14 +173,14 @@ INIT.on('cycle', function (event) {
173173

174174
// TAIL
175175

176-
const TAIL = new Benchmark.Suite().on('start', function () {
176+
const TAIL = new Benchmark.Suite().on('start', () => {
177177
console.log('\nTAIL\n==\n');
178178
});
179179

180180
if (M <= 10000)
181181
TAIL.add(
182182
'Array#shift',
183-
function () {
183+
() => {
184184
const _a = a.slice();
185185
for (let i = 0; i < _M; ++i) _a.shift();
186186
},
@@ -189,14 +189,14 @@ if (M <= 10000)
189189

190190
TAIL.add(
191191
'fingertree#removeLast',
192-
function () {
192+
() => {
193193
let _t = qt;
194194
for (let i = 0; i < _M; ++i) _t = _t.removeFirst();
195195
},
196196
{setup}
197197
).add(
198198
'@aureooms/js-fingertree#init',
199-
function () {
199+
() => {
200200
let _t = at;
201201
for (let i = 0; i < _M; ++i) _t = _t.tail();
202202
},
@@ -206,17 +206,17 @@ TAIL.add(
206206
if (M <= 1000)
207207
TAIL.add(
208208
'Mock#init',
209-
function () {
209+
() => {
210210
let _m = a;
211211
for (let i = 0; i < _M; ++i) _m = _m.slice(1);
212212
},
213213
{setup}
214214
);
215215

216-
TAIL.on('cycle', function (event) {
216+
TAIL.on('cycle', (event) => {
217217
console.log(String(event.target));
218218
})
219-
.on('error', function (event) {
219+
.on('error', (event) => {
220220
console.dir(event);
221221
})
222222
.on('complete', function () {
@@ -227,12 +227,12 @@ TAIL.on('cycle', function (event) {
227227
// APPEND
228228

229229
const APPEND = new Benchmark.Suite()
230-
.on('start', function () {
230+
.on('start', () => {
231231
console.log('\nAPPEND\n==\n');
232232
})
233233
.add(
234234
'@aureooms/js-fingertree#append',
235-
function () {
235+
() => {
236236
at.append(range(M));
237237
},
238238
{setup}
@@ -241,13 +241,13 @@ const APPEND = new Benchmark.Suite()
241241
if (M <= 1000)
242242
APPEND.add(
243243
'Mock#append',
244-
function () {
244+
() => {
245245
a.concat(Array.from(range(M)));
246246
},
247247
{setup}
248248
);
249249

250-
APPEND.on('cycle', function (event) {
250+
APPEND.on('cycle', (event) => {
251251
console.log(String(event.target));
252252
})
253253
.on('complete', function () {
@@ -258,12 +258,12 @@ APPEND.on('cycle', function (event) {
258258
// PREPEND
259259

260260
const PREPEND = new Benchmark.Suite()
261-
.on('start', function () {
261+
.on('start', () => {
262262
console.log('\nPREPEND\n==\n');
263263
})
264264
.add(
265265
'@aureooms/js-fingertree#prepend',
266-
function () {
266+
() => {
267267
at.prepend(range(M));
268268
},
269269
{setup}
@@ -272,13 +272,13 @@ const PREPEND = new Benchmark.Suite()
272272
if (M <= 1000)
273273
PREPEND.add(
274274
'Mock#prepend',
275-
function () {
275+
() => {
276276
Array.from(range(M)).concat(a);
277277
},
278278
{setup}
279279
);
280280

281-
PREPEND.on('cycle', function (event) {
281+
PREPEND.on('cycle', (event) => {
282282
console.log(String(event.target));
283283
})
284284
.on('complete', function () {
@@ -289,19 +289,19 @@ PREPEND.on('cycle', function (event) {
289289
// FROM
290290

291291
new Benchmark.Suite()
292-
.on('start', function () {
292+
.on('start', () => {
293293
console.log('\nFROM\n==\n');
294294
})
295-
.add('fingertree.fromArray', function () {
295+
.add('fingertree.fromArray', () => {
296296
fromArray(Array.from(range(M)));
297297
})
298-
.add('@aureooms/js-fingertree.from', function () {
298+
.add('@aureooms/js-fingertree.from', () => {
299299
from(COUNTER, range(M));
300300
})
301-
.add('Mock.from', function () {
301+
.add('Mock.from', () => {
302302
Array.from(range(M));
303303
})
304-
.on('cycle', function (event) {
304+
.on('cycle', (event) => {
305305
console.log(String(event.target));
306306
})
307307
.on('complete', function () {
@@ -312,28 +312,28 @@ new Benchmark.Suite()
312312
// SPLIT
313313

314314
const SPLIT = new Benchmark.Suite()
315-
.on('start', function () {
315+
.on('start', () => {
316316
console.log('\nSPLIT\n==\n');
317317
})
318318
.add(
319319
'fingertree#split',
320-
function () {
320+
() => {
321321
const _M = M;
322322
const _qt = qt;
323323
for (let i = 0; i < _M; ++i)
324-
_qt.split(function (m) {
324+
_qt.split((m) => {
325325
return m > i;
326326
});
327327
},
328328
{setup}
329329
)
330330
.add(
331331
'@aureooms/js-fingertree#split',
332-
function () {
332+
() => {
333333
const _M = M;
334334
const _at = at;
335335
for (let i = 0; i < _M; ++i)
336-
_at.split(function (m) {
336+
_at.split((m) => {
337337
return m > i;
338338
});
339339
},
@@ -343,7 +343,7 @@ const SPLIT = new Benchmark.Suite()
343343
if (M < 1000)
344344
SPLIT.add(
345345
'Mock#split',
346-
function () {
346+
() => {
347347
const _M = M;
348348
const _a = a;
349349
for (let i = 0; i < _M; ++i) {
@@ -354,7 +354,7 @@ if (M < 1000)
354354
{setup}
355355
);
356356

357-
SPLIT.on('cycle', function (event) {
357+
SPLIT.on('cycle', (event) => {
358358
console.log(String(event.target));
359359
})
360360
.on('complete', function () {
@@ -365,14 +365,14 @@ SPLIT.on('cycle', function (event) {
365365
// CONCAT
366366

367367
new Benchmark.Suite()
368-
.on('start', function () {
368+
.on('start', () => {
369369
console.log('\nCONCAT\n==\n');
370370
})
371371
// I had to put this version first because the second uses a lot of memory.
372372
// This is probably because qiao/fingetree.js keeps references of used thunks.
373373
.add(
374374
'@aureooms/js-fingertree#concat',
375-
function () {
375+
() => {
376376
const _M = M;
377377
const _s = splits;
378378
for (let i = 0; i < _M; ++i) _s[i][0].concat(_s[i][1]);
@@ -383,7 +383,7 @@ new Benchmark.Suite()
383383
const splits = [];
384384
for (let i = 0; i < M; ++i) {
385385
splits.push(
386-
t.split(function (m) {
386+
t.split((m) => {
387387
return m > i;
388388
})
389389
);
@@ -396,7 +396,7 @@ new Benchmark.Suite()
396396
)
397397
.add(
398398
'fingertree#concat',
399-
function () {
399+
() => {
400400
const _M = M;
401401
const _s = splits;
402402
for (let i = 0; i < _M; ++i) _s[i][0].concat(_s[i][1]);
@@ -407,7 +407,7 @@ new Benchmark.Suite()
407407
const splits = [];
408408
for (let i = 0; i < M; ++i) {
409409
splits.push(
410-
t.split(function (m) {
410+
t.split((m) => {
411411
return m > i;
412412
})
413413
);
@@ -418,7 +418,7 @@ new Benchmark.Suite()
418418
}
419419
}
420420
)
421-
.on('cycle', function (event) {
421+
.on('cycle', (event) => {
422422
console.log(String(event.target));
423423
})
424424
.on('complete', function () {

_benchmark/tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ console.timeEnd('append');
6464

6565
console.time('split');
6666
for (i = 0; i < length; ++i) {
67-
t.split(function (m) {
67+
t.split((m) => {
6868
return m > i;
6969
});
7070
}
@@ -76,7 +76,7 @@ const time = Number(new Date()) - start;
7676
const splits = [];
7777
for (i = 0; i < length; ++i) {
7878
splits.push(
79-
t.split(function (m) {
79+
t.split((m) => {
8080
return m > i;
8181
})
8282
);

0 commit comments

Comments
 (0)