Skip to content

Commit 94de468

Browse files
committed
Better var names
1 parent 57652d1 commit 94de468

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

benchmarks/index.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,39 @@ const n_one = FromNumber(1, BINARY_PRECISION);
3232
const n_three = FromNumber(3, BINARY_PRECISION);
3333

3434
// Prepare @naviary/bigdecimal inputs
35-
const naviary_A = divide_floating(n_one, n_three, BINARY_PRECISION);
36-
const naviary_B = sqrt(FromNumber(2, BINARY_PRECISION), BINARY_PRECISION);
35+
const bigdecimal_A = divide_floating(n_one, n_three, BINARY_PRECISION);
36+
const bigdecimal_B = sqrt(FromNumber(2, BINARY_PRECISION), BINARY_PRECISION);
3737

3838
// Prepare decimal.js inputs
3939
const decimal_A = new Decimal(1).div(3);
4040
const decimal_B = new Decimal(2).sqrt();
4141

4242
// Prepare bignumber.js inputs
43-
const bn_A = new BigNumber(1).div(3);
44-
const bn_B = new BigNumber(2).sqrt();
43+
const bignumber_A = new BigNumber(1).div(3);
44+
const bignumber_B = new BigNumber(2).sqrt();
4545

4646
// BENCHMARKS
4747

4848
group('Addition (0.33 + 1.41)', () => {
4949
bench('decimal.js', () => decimal_A.plus(decimal_B));
50-
bench('bignumber.js', () => bn_A.plus(bn_B));
51-
bench('@naviary/bigdecimal', () => add(naviary_A, naviary_B));
50+
bench('bignumber.js', () => bignumber_A.plus(bignumber_B));
51+
bench('@naviary/bigdecimal', () => add(bigdecimal_A, bigdecimal_B));
5252
});
5353

5454
group('Multiplication (0.33 * 1.41)', () => {
5555
bench('decimal.js', () => decimal_A.times(decimal_B));
56-
bench('bignumber.js', () => bn_A.multipliedBy(bn_B));
57-
bench('@naviary/bigdecimal', () => multiply_floating(naviary_A, naviary_B, BINARY_PRECISION));
56+
bench('bignumber.js', () => bignumber_A.multipliedBy(bignumber_B));
57+
bench('@naviary/bigdecimal', () =>
58+
multiply_floating(bigdecimal_A, bigdecimal_B, BINARY_PRECISION),
59+
);
5860
});
5961

6062
group('Division (0.33 / 1.41)', () => {
6163
bench('decimal.js', () => decimal_A.div(decimal_B));
62-
bench('bignumber.js', () => bn_A.div(bn_B));
63-
bench('@naviary/bigdecimal', () => divide_floating(naviary_A, naviary_B, BINARY_PRECISION));
64+
bench('bignumber.js', () => bignumber_A.div(bignumber_B));
65+
bench('@naviary/bigdecimal', () =>
66+
divide_floating(bigdecimal_A, bigdecimal_B, BINARY_PRECISION),
67+
);
6468
});
6569

6670
group('Feature: Fixed-Point Multiplication', () => {
@@ -69,10 +73,10 @@ group('Feature: Fixed-Point Multiplication', () => {
6973
decimal_A.times(decimal_B).toDecimalPlaces(DECIMAL_PRECISION),
7074
);
7175
bench('bignumber.js (simulated)', () =>
72-
bn_A.multipliedBy(bn_B).decimalPlaces(DECIMAL_PRECISION),
76+
bignumber_A.multipliedBy(bignumber_B).decimalPlaces(DECIMAL_PRECISION),
7377
);
7478
// My native fixed-point method
75-
bench('@naviary/bigdecimal', () => multiply_fixed(naviary_A, naviary_B));
79+
bench('@naviary/bigdecimal', () => multiply_fixed(bigdecimal_A, bigdecimal_B));
7680
});
7781

7882
await run();

0 commit comments

Comments
 (0)