Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Last active April 17, 2018 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/4afe3a5d2a9b97e57835a8c4d826243c to your computer and use it in GitHub Desktop.
Save piscisaureus/4afe3a5d2a9b97e57835a8c4d826243c to your computer and use it in GitHub Desktop.
import { ones } from "./index";
const t1 = ones([100, 100]);
const t2 = ones([100, 100]);
let count = 10;
let total = 0;
const begin = Date.now() / 1000;
let end = begin;
for (let i = 0; i < 20; i++) {
const start = end;
for (let i = 0; i < count; i++) {
const t3 = t1.matMul(t2);
}
end = Date.now() / 1000;
const elapsed = end - start;
const throughput = count / elapsed;
console.log(
`time: ${elapsed}s count: ${count} throughput: ${throughput}/s`);
total += count;
count = Math.round(total / (end - begin));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment