From c189f2be73561218ddfb3cd99d6db4dda4371c35 Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 16 Jan 2024 10:39:37 +0100 Subject: [PATCH 1/9] adapt tictoc and examples build --- src/examples/utils/tic-toc.node.ts | 12 ++++++------ src/examples/utils/tic-toc.ts | 8 ++++---- tsconfig.examples.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) 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..32de080832 100644 --- a/src/examples/utils/tic-toc.ts +++ b/src/examples/utils/tic-toc.ts @@ -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; } diff --git a/tsconfig.examples.json b/tsconfig.examples.json index 9d9e39d1eb..f76d1764b4 100644 --- a/tsconfig.examples.json +++ b/tsconfig.examples.json @@ -3,7 +3,7 @@ "include": ["./src/examples/**/*.ts"], "exclude": [], "compilerOptions": { - "outDir": "dist/", + "outDir": "dist/node", "importHelpers": false } } From 9732d5800b21d3284e03cb030649274e504288e4 Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 16 Jan 2024 16:06:55 +0100 Subject: [PATCH 2/9] add assert() in more basic module --- src/lib/util/assert.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/lib/util/assert.ts 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'); + } +} From 65affe67e5e604f000522019f63af12f565cfc1f Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 16 Jan 2024 16:20:42 +0100 Subject: [PATCH 3/9] submodules --- src/bindings | 2 +- src/mina | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bindings b/src/bindings index a884dc593d..4a53d10476 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit a884dc593dbab69e55ab9602b998ec12dfc3a288 +Subproject commit 4a53d10476eef30016941e54d57a047a521cc3f6 diff --git a/src/mina b/src/mina index 2a968c8347..00e3aa4ef3 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 2a968c83477ed9f9e3b30a02cc357e541b76dcac +Subproject commit 00e3aa4ef3aaaa13822a714f32926c824daae487 From eee19aa61dd051944a726a51113740b609c5aac4 Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 16 Jan 2024 18:03:33 +0100 Subject: [PATCH 4/9] revert examples build change --- tsconfig.examples.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.examples.json b/tsconfig.examples.json index f76d1764b4..9d9e39d1eb 100644 --- a/tsconfig.examples.json +++ b/tsconfig.examples.json @@ -3,7 +3,7 @@ "include": ["./src/examples/**/*.ts"], "exclude": [], "compilerOptions": { - "outDir": "dist/node", + "outDir": "dist/", "importHelpers": false } } From db6c2a086869f482e9972a78d2ca35e5a797108c Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 16 Jan 2024 18:06:26 +0100 Subject: [PATCH 5/9] bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 4a53d10476..163af623b2 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 4a53d10476eef30016941e54d57a047a521cc3f6 +Subproject commit 163af623b2a0ac533b2004e783bf0e8865356a74 From 226ab3157fa53ff6e20864614372a877dd334350 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 17 Jan 2024 09:38:30 +0100 Subject: [PATCH 6/9] bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 163af623b2..309cac009f 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 163af623b2a0ac533b2004e783bf0e8865356a74 +Subproject commit 309cac009f42055567737ba77fc978e859e30c3b From bd501fb6793fb3442f417b23331977cbbf5653c9 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 17 Jan 2024 09:47:40 +0100 Subject: [PATCH 7/9] fixup bench script in bindings --- src/bindings | 2 +- src/examples/utils/tic-toc.ts | 1 - src/lib/util/tic-toc.ts | 18 ++++++++++++++++++ tsconfig.test.json | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/lib/util/tic-toc.ts diff --git a/src/bindings b/src/bindings index 309cac009f..df4ca0e729 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 309cac009f42055567737ba77fc978e859e30c3b +Subproject commit df4ca0e7291d7eb0af5034726d8eb975e359c62d diff --git a/src/examples/utils/tic-toc.ts b/src/examples/utils/tic-toc.ts index 32de080832..a7d2ab20b8 100644 --- a/src/examples/utils/tic-toc.ts +++ b/src/examples/utils/tic-toc.ts @@ -5,7 +5,6 @@ export { tic, toc }; let timingStack: [string | undefined, number][] = []; -let i = 0; function tic(label?: string) { if (label) console.log(`${label}... `); 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/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" ], From ebca276e82ed0971e5705591c9c0129ce5c8d1d6 Mon Sep 17 00:00:00 2001 From: Gregor Date: Fri, 26 Jan 2024 08:55:54 +0100 Subject: [PATCH 8/9] submodules --- src/bindings | 2 +- src/mina | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bindings b/src/bindings index df4ca0e729..14bddb6f69 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit df4ca0e7291d7eb0af5034726d8eb975e359c62d +Subproject commit 14bddb6f69cd0240b81a9d74488a5a6e10ad319f diff --git a/src/mina b/src/mina index 00e3aa4ef3..f4e67fe467 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 00e3aa4ef3aaaa13822a714f32926c824daae487 +Subproject commit f4e67fe4672762b327026614882a2e8847287688 From b8e90d5417208109078b854ce4b2daa463323774 Mon Sep 17 00:00:00 2001 From: Gregor Date: Fri, 26 Jan 2024 12:11:51 +0100 Subject: [PATCH 9/9] changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)