Skip to content

Commit

Permalink
Add benchmarks to iterators (#238)
Browse files Browse the repository at this point in the history
* Remove old benchmarks and add benchmarks to .gitignore

* Add benchmarks to iterators

* Improvement/renaming to bench script

* 6.1.10
  • Loading branch information
mateogianolio authored May 30, 2023
1 parent e882ab2 commit 7f61215
Show file tree
Hide file tree
Showing 178 changed files with 137 additions and 91 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
coverage
.DS_Store
built
benchmarks
Binary file removed benchmarks/NDArray/abs.png
Binary file not shown.
Binary file removed benchmarks/NDArray/acos.png
Binary file not shown.
Binary file removed benchmarks/NDArray/acosh.png
Binary file not shown.
Binary file removed benchmarks/NDArray/add.png
Binary file not shown.
Binary file removed benchmarks/NDArray/angle.png
Binary file not shown.
Binary file removed benchmarks/NDArray/array.png
Binary file not shown.
Binary file removed benchmarks/NDArray/asin.png
Binary file not shown.
Binary file removed benchmarks/NDArray/asinh.png
Binary file not shown.
Binary file removed benchmarks/NDArray/atan.png
Binary file not shown.
Binary file removed benchmarks/NDArray/atanh.png
Binary file not shown.
Binary file removed benchmarks/NDArray/augment.png
Binary file not shown.
Binary file removed benchmarks/NDArray/binOp.png
Binary file not shown.
Binary file removed benchmarks/NDArray/cbrt.png
Binary file not shown.
Binary file removed benchmarks/NDArray/ceil.png
Binary file not shown.
Binary file removed benchmarks/NDArray/check.png
Binary file not shown.
Binary file removed benchmarks/NDArray/combine.png
Binary file not shown.
Binary file removed benchmarks/NDArray/copy.png
Binary file not shown.
Binary file removed benchmarks/NDArray/cos.png
Binary file not shown.
Binary file removed benchmarks/NDArray/cosh.png
Binary file not shown.
Binary file removed benchmarks/NDArray/cross.png
Binary file not shown.
Binary file removed benchmarks/NDArray/det.png
Binary file not shown.
Binary file removed benchmarks/NDArray/diag.png
Binary file not shown.
Binary file removed benchmarks/NDArray/dot.png
Binary file not shown.
Binary file removed benchmarks/NDArray/eig.png
Binary file not shown.
Binary file removed benchmarks/NDArray/equals.png
Binary file not shown.
Binary file removed benchmarks/NDArray/equidimensional.png
Diff not rendered.
Binary file removed benchmarks/NDArray/equilateral.png
Diff not rendered.
Binary file removed benchmarks/NDArray/exp.png
Diff not rendered.
Binary file removed benchmarks/NDArray/expm1.png
Diff not rendered.
Binary file removed benchmarks/NDArray/eye.png
Diff not rendered.
Binary file removed benchmarks/NDArray/fill.png
Diff not rendered.
Binary file removed benchmarks/NDArray/floor.png
Diff not rendered.
Binary file removed benchmarks/NDArray/forEach.png
Diff not rendered.
Binary file removed benchmarks/NDArray/fround.png
Diff not rendered.
Binary file removed benchmarks/NDArray/gauss.png
Diff not rendered.
Binary file removed benchmarks/NDArray/get.png
Diff not rendered.
Binary file removed benchmarks/NDArray/inv.png
Diff not rendered.
Binary file removed benchmarks/NDArray/log.png
Diff not rendered.
Binary file removed benchmarks/NDArray/log10.png
Diff not rendered.
Binary file removed benchmarks/NDArray/log1p.png
Diff not rendered.
Binary file removed benchmarks/NDArray/log2.png
Diff not rendered.
Binary file removed benchmarks/NDArray/lu.png
Diff not rendered.
Binary file removed benchmarks/NDArray/lu_factor.png
Diff not rendered.
Binary file removed benchmarks/NDArray/magic.png
Diff not rendered.
Binary file removed benchmarks/NDArray/map.png
Diff not rendered.
Binary file removed benchmarks/NDArray/matrix.png
Diff not rendered.
Binary file removed benchmarks/NDArray/max.png
Diff not rendered.
Binary file removed benchmarks/NDArray/mean.png
Diff not rendered.
Binary file removed benchmarks/NDArray/min.png
Diff not rendered.
Binary file removed benchmarks/NDArray/multiply.png
Diff not rendered.
Binary file removed benchmarks/NDArray/norm.png
Diff not rendered.
Binary file removed benchmarks/NDArray/normalize.png
Diff not rendered.
Binary file removed benchmarks/NDArray/ones.png
Diff not rendered.
Binary file removed benchmarks/NDArray/pow.png
Diff not rendered.
Binary file removed benchmarks/NDArray/prod.png
Diff not rendered.
Binary file removed benchmarks/NDArray/product.png
Diff not rendered.
Binary file removed benchmarks/NDArray/project.png
Diff not rendered.
Binary file removed benchmarks/NDArray/push.png
Diff not rendered.
Binary file removed benchmarks/NDArray/random.png
Diff not rendered.
Binary file removed benchmarks/NDArray/range.png
Diff not rendered.
Binary file removed benchmarks/NDArray/rank.png
Diff not rendered.
Binary file removed benchmarks/NDArray/reciprocal.png
Diff not rendered.
Binary file removed benchmarks/NDArray/reduce.png
Diff not rendered.
Binary file removed benchmarks/NDArray/reshape.png
Diff not rendered.
Binary file removed benchmarks/NDArray/round.png
Diff not rendered.
Binary file removed benchmarks/NDArray/row_add.png
Diff not rendered.
Binary file removed benchmarks/NDArray/scale.png
Diff not rendered.
Binary file removed benchmarks/NDArray/set.png
Diff not rendered.
Binary file removed benchmarks/NDArray/sign.png
Diff not rendered.
Binary file removed benchmarks/NDArray/sin.png
Diff not rendered.
Binary file removed benchmarks/NDArray/sinh.png
Diff not rendered.
Binary file removed benchmarks/NDArray/slice.png
Diff not rendered.
Binary file removed benchmarks/NDArray/solve.png
Diff not rendered.
Binary file removed benchmarks/NDArray/sqrt.png
Diff not rendered.
Binary file removed benchmarks/NDArray/square.png
Diff not rendered.
Binary file removed benchmarks/NDArray/subtract.png
Diff not rendered.
Binary file removed benchmarks/NDArray/sum.png
Diff not rendered.
Binary file removed benchmarks/NDArray/swap.png
Diff not rendered.
Binary file removed benchmarks/NDArray/tan.png
Diff not rendered.
Binary file removed benchmarks/NDArray/tanh.png
Diff not rendered.
Binary file removed benchmarks/NDArray/toArray.png
Diff not rendered.
Binary file removed benchmarks/NDArray/toString.png
Diff not rendered.
Binary file removed benchmarks/NDArray/trace.png
Diff not rendered.
Binary file removed benchmarks/NDArray/transpose.png
Diff not rendered.
Binary file removed benchmarks/NDArray/trunc.png
Diff not rendered.
Binary file removed benchmarks/NDArray/zeros.png
Diff not rendered.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vectorious",
"version": "6.1.9",
"version": "6.1.10",
"description": "A high performance linear algebra library.",
"main": "dist/index.js",
"browser": "dist/index.browser.js",
Expand Down
7 changes: 5 additions & 2 deletions src/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const bench = (

const xs: number[] = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096];

stream.write(`${group} > ${name}`);
stream.write(`${group} > ${name}\n`);
console.info(`${group} > ${name}`);

funcs.forEach((func: (...args: any[]) => void, i: number) => {
xs.forEach((x: number) => {
Expand All @@ -29,7 +30,9 @@ export const bench = (
250
);

stream.write(`${i === 0 ? '[prototype]' : '[static'} n=${x} ${result}\n`);
const name = func.name || i;
stream.write(`[${name}] n=${x} ${result}\n`);
console.info(`[${name}] n=${x} ${result}`);
});
});
};
2 changes: 1 addition & 1 deletion src/core/abs.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'abs',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/acos.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'acos',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/acosh.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'acosh',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/add.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'add',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/angle.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'angle',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/array.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { array } from './array';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'array',
(n: number): [number] => [n],
(n: number): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/asin.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'asin',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/asinh.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'asinh',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/atan.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'atan',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/atanh.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'atanh',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/augment.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'augment',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n))), random(floor(sqrt(n)), floor(sqrt(n)))],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/binOp.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'binOp',
(n: number) => [random(n), random(n), (a: number, b: number): number => a + b],
(x, y, op: (a: number, b: number) => number): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/cbrt.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'cbrt',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/ceil.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'ceil',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/check.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'check',
(n: number) => [random(n), Math.floor(Math.random() * n)],
(x, i: number): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/combine.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'combine',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/copy.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'copy',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/cos.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'cos',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/cosh.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'cosh',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/cross.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'cross',
() => [random(3), random(3)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/det.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'det',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n)))],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/diagonal.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'diag',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n)))],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/dot.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'dot',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/eig.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'eig',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n)))],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/equals.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'equals',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/equidimensional.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'equidimensional',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/equilateral.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'equilateral',
(n: number) => [random(n), random(n)],
(x, y): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/exp.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'exp',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/expm1.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'expm1',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/eye.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { eye } from './eye';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'eye',
(n: number): [number] => [n],
(n: number): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/fill.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'fill',
(n: number) => [random(n), Math.random()],
(x, value: number) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/floor.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'floor',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/forEach.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'forEach',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/fround.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'fround',
(n: number) => [random(n)],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/gauss.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'gauss',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n)))],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/get.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'get',
(n: number) => [random(n), Math.floor(Math.random() * n)],
(x, i: number) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/inv.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { bench } from '../bench';
const { floor, sqrt } = Math;

bench(
'NDArray',
'core',
'inv',
(n: number) => [random(floor(sqrt(n)), floor(sqrt(n)))],
(x): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/log.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { random } from './random';
import { bench } from '../bench';

bench(
'NDArray',
'core',
'log',
(n: number) => [random(n)],
(x): void => {
Expand Down
Loading

0 comments on commit 7f61215

Please sign in to comment.