diff --git a/CHANGELOG.md b/CHANGELOG.md index 0594d6dc9e..36b3109217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed -- Improve performance of Poseidon hashing by a factor of 13x https://github.com/o1-labs/o1js/pull/1378 +- Improve performance of Wasm Poseidon hashing by a factor of 13x https://github.com/o1-labs/o1js/pull/1378 + - Speeds up local blockchain tests without proving by ~40% +- Improve performance of Field inverse https://github.com/o1-labs/o1js/pull/1373 + - Speeds up proving by ~2-4% ## [0.15.3](https://github.com/o1-labs/o1js/compare/1ad7333e9e...be748e42e) diff --git a/src/bindings b/src/bindings index 6df837ccf6..14bddb6f69 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 6df837ccf654d3c1cc027a78718cca0eb2299e96 +Subproject commit 14bddb6f69cd0240b81a9d74488a5a6e10ad319f diff --git a/src/examples/utils/tic-toc.node.ts b/src/examples/utils/tic-toc.node.ts index 9e8d50634a..ea6c4d012d 100644 --- a/src/examples/utils/tic-toc.node.ts +++ b/src/examples/utils/tic-toc.node.ts @@ -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; } diff --git a/src/examples/utils/tic-toc.ts b/src/examples/utils/tic-toc.ts index 4b66514d8d..a7d2ab20b8 100644 --- a/src/examples/utils/tic-toc.ts +++ b/src/examples/utils/tic-toc.ts @@ -4,17 +4,16 @@ export { tic, toc }; -let timingStack: [string, number][] = []; -let i = 0; +let timingStack: [string | undefined, number][] = []; -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; } diff --git a/src/lib/util/assert.ts b/src/lib/util/assert.ts new file mode 100644 index 0000000000..df3f5a6749 --- /dev/null +++ b/src/lib/util/assert.ts @@ -0,0 +1,7 @@ +export { assert }; + +function assert(stmt: boolean, message?: string): asserts stmt { + if (!stmt) { + throw Error(message ?? 'Assertion failed'); + } +} diff --git a/src/lib/util/tic-toc.ts b/src/lib/util/tic-toc.ts new file mode 100644 index 0000000000..b9dfd61771 --- /dev/null +++ b/src/lib/util/tic-toc.ts @@ -0,0 +1,18 @@ +/** + * Helper for printing timings, in the spirit of Python's `tic` and `toc`. + */ + +export { tic, toc }; + +let timingStack: [string | undefined, number][] = []; + +function tic(label?: string) { + timingStack.push([label, performance.now()]); +} + +function toc() { + let [label, start] = timingStack.pop()!; + let time = (performance.now() - start) / 1000; + if (label) console.log(`${label}... ${time.toFixed(3)} sec`); + return time; +} diff --git a/src/mina b/src/mina index 94ae65b1d4..f4e67fe467 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 94ae65b1d4d25459412fa34e7d1b51a7b991a307 +Subproject commit f4e67fe4672762b327026614882a2e8847287688 diff --git a/tsconfig.test.json b/tsconfig.test.json index 85717a9f8c..bd3694b834 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.json", "include": [ "./src/**/*.unit-test.ts", + "./src/lib/**/*.ts", "./src/snarky.js", "./src/bindings/js/wrapper.js" ],