Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster TS field inverse #1373

Merged
merged 10 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bindings
12 changes: 6 additions & 6 deletions src/examples/utils/tic-toc.node.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Helper for printing timings, in the spirit of Python's `tic` and `toc`.
*
* This is a slightly nicer version of './tic-tic.ts' which only works in Node.
* This is a slightly nicer version of './tic-toc.ts' which only works in Node.
*/

export { tic, toc };

let timingStack: [string, number][] = [];
let i = 0;
let timingStack: [string | undefined, number][] = [];

function tic(label = `Run command ${i++}`) {
process.stdout.write(`${label}... `);
function tic(label?: string) {
if (label) process.stdout.write(`${label}... `);
timingStack.push([label, performance.now()]);
}

function toc() {
let [label, start] = timingStack.pop()!;
let time = (performance.now() - start) / 1000;
process.stdout.write(`\r${label}... ${time.toFixed(3)} sec\n`);
if (label) process.stdout.write(`\r${label}... ${time.toFixed(3)} sec\n`);
return time;
}
8 changes: 4 additions & 4 deletions src/examples/utils/tic-toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

export { tic, toc };

let timingStack: [string, number][] = [];
let timingStack: [string | undefined, number][] = [];
let i = 0;

function tic(label = `Run command ${i++}`) {
console.log(`${label}... `);
function tic(label?: string) {
if (label) console.log(`${label}... `);
timingStack.push([label, performance.now()]);
}

function toc() {
let [label, start] = timingStack.pop()!;
let time = (performance.now() - start) / 1000;
console.log(`\r${label}... ${time.toFixed(3)} sec\n`);
if (label) console.log(`${label}... ${time.toFixed(3)} sec`);
return time;
}
7 changes: 7 additions & 0 deletions src/lib/util/assert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { assert };

function assert(stmt: boolean, message?: string): asserts stmt {
if (!stmt) {
throw Error(message ?? 'Assertion failed');
}
}
2 changes: 1 addition & 1 deletion src/mina
Submodule mina updated 0 files