Skip to content

Commit 38e72d9

Browse files
a-flying-potatomake-github-pseudonymous-again
authored andcommittedMar 23, 2021
🤖 chore: Lint source files.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/aureooms/rejuvenate/blob/67ba7d5e9b38c8944d42909a3a30b0710559b446/src/transforms/sources:initial-lint.js Please contact the author of the transform if you believe there was an error.
1 parent 967ece3 commit 38e72d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+39178
-32462
lines changed
 

Diff for: ‎_benchmark/index.js

+425-386
Large diffs are not rendered by default.

Diff for: ‎_profile/add.js

+23-17
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ console.time('prepare');
22
require('@babel/polyfill');
33
const crypto = require('crypto');
44
const ArgumentParser = require('argparse').ArgumentParser;
5-
//const itertools = require('@aureooms/js-itertools');
5+
// Const itertools = require('@aureooms/js-itertools');
66
const XorShift128Plus = require('xorshift.js').XorShift128Plus;
7-
const { ZZ , DEFAULT_DISPLAY_BASE , DEFAULT_REPRESENTATION_BASE } = require('..');
8-
//const BN = require('bn.js');
7+
const {ZZ, DEFAULT_DISPLAY_BASE, DEFAULT_REPRESENTATION_BASE} = require('..');
8+
// Const BN = require('bn.js');
99

1010
const parser = new ArgumentParser();
1111
parser.addArgument(['M'], {defaultValue: 1000, nargs: '?'});
1212
parser.addArgument(['-N'], {defaultValue: 1000});
13-
parser.addArgument(['-s'], {defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex')});
13+
parser.addArgument(['-s'], {
14+
defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex'),
15+
});
1416
const args = parser.parseArgs();
1517
const M = args.M;
1618
const N = args.N;
@@ -21,22 +23,25 @@ console.log('number of operations:', N);
2123
console.log('seed:', seed);
2224

2325
const MAX_PRINT_DIGITS = 79;
24-
const _show = _x => _x.length <= MAX_PRINT_DIGITS ?
25-
_x :
26-
_x.slice(0,(MAX_PRINT_DIGITS-3)/2) + '...' + _x.slice(_x.length-(MAX_PRINT_DIGITS-3)/2) ;
26+
const _show = (_x) =>
27+
_x.length <= MAX_PRINT_DIGITS
28+
? _x
29+
: _x.slice(0, (MAX_PRINT_DIGITS - 3) / 2) +
30+
'...' +
31+
_x.slice(_x.length - (MAX_PRINT_DIGITS - 3) / 2);
2732

2833
const prng = new XorShift128Plus(seed);
2934
const _x = prng.randomBytes(M).toString('hex');
3035
console.log('_x:', _show(_x));
3136
const _y = prng.randomBytes(M).toString('hex');
3237
console.log('_y:', _show(_y));
3338

34-
let x = ZZ.from(_x, 16);
39+
const x = ZZ.from(_x, 16);
3540
const y = ZZ.from(_y, 16);
36-
//let x = BigInt('0x'+_x) ;
37-
//const y = BigInt('0x'+_y) ;
38-
//let x = new BN(_x,16) ;
39-
//const y = new BN(_y,16) ;
41+
// Let x = BigInt('0x'+_x) ;
42+
// const y = BigInt('0x'+_y) ;
43+
// let x = new BN(_x,16) ;
44+
// const y = new BN(_y,16) ;
4045
let z = x;
4146

4247
console.log('limbs x:', x.limbs.length);
@@ -48,12 +53,13 @@ console.timeEnd('prepare');
4853

4954
console.time('loop');
5055
for (let k = 0; k < N; ++k) {
51-
//x *= y;
52-
z = z.add(y);
53-
z = z.sub(y);
54-
//x = x + y;
55-
//x = x - y;
56+
// X *= y;
57+
z = z.add(y);
58+
z = z.sub(y);
59+
// X = x + y;
60+
// x = x - y;
5661
}
62+
5763
console.timeEnd('loop');
5864

5965
// eslint-disable-next-line no-self-compare

0 commit comments

Comments
 (0)
Please sign in to comment.