Munkres

Benchmark created on


Description

Benchmarking munkes package

Preparation HTML

<script type="module">
import munkres from 'https://cdn.jsdelivr.net/npm/munkres@1.2.4/+esm'
</script>

Setup

const MIN_VALUE = 1;
const MAX_VALUE = Number.MAX_SAFE_INTEGER;

function randomInt(min, max) {
  return min + Math.trunc((max - min) * Math.random());
}

function genInt() {
  return randomInt(MIN_VALUE, MAX_VALUE);
}

function genBig() {
  return BigInt(genInt());
}

function genMatrix(Y, X, callbackfn) {
  return [];
}

function genMatrix(Y, X, callbackFn) {
	const matrix = new Array(Y);
	for (let y = 0; y < Y; ++y) {
		const row = new Array(X);
		for (let x = 0; x < X; ++x) {
			row[x] = callbackFn(y, x);
		}
		matrix[y] = row;
	}
	return matrix;
}

const MATS = new Map();
for (let n = 512; n <= 4096; n *= 2) {
	MATS.set(n, genMatrix(n, n, genInt));
}

return MATS;

Teardown

MATS.clear();

Test runner

Ready to run.

Testing in
TestOps/sec
512x512
munkres(MATS.get(512));
ready
1024x1024
munkres(MATS.get(1024));
ready
2048x2048
munkres(MATS.get(2048));
ready
4096x4096
munkres(MATS.get(4096));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.