diff --git a/README.md b/README.md index 31cf0696..b1ad3a42 100644 --- a/README.md +++ b/README.md @@ -45,40 +45,79 @@ Check the details here: [performance](https://zkmopro.org/docs/performance). - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CircuitsAndroid (Samsung S23U)snarkjs groth16 fullprovemopro (rust-witness + ark-works)witnesscalc + rapidsnark
Keccak25611.388 s2.54 s (~4.4x)0.847 s (~13x)
SHA2563.672 s1.68 s (~2.1x)0.257 s (~14x)
RSA17.4 s9.59 s (~1.8x)1.1 s (~16x)
Semaphore2.22 s0.309 s (~7.1x)0.176 ms (~12x)
Anon Aadhaar54.753 s35.955 s (~1.5x)3.759 s (~14x)
+ + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
iOS (iPhone 16 Pro) snarkjs groth16 fullprove mopro (rust-witness + ark-works) witnesscalc + rapidsnark
Keccak2568406.2 ms1381.8 ms (~6x)2792.6 ms (~3x)5.329 s1.097 s (~5x)0.772 s (~7x)
SHA2562537.6 ms640.7 ms (~4x)817.5 ms (~3.1x)1.578 s0.592 s (~2.6x)0.227 s (~6.9x)
RSA15.7 s6.1 s (~2.5x)3.1 s (~5x)9.584 s4.563 s (~2.1x)0.9 s (~10.6x)
Semaphore902 ms257 ms (~3.5x)347 ms (~2.5x)1.079 s0.189 s (~5.7x)0.165 ms (~6.5x)
Anon Aadhaar26 s17 s (~1.5x)11 s (~2.3x)28.679 s12.171 s (~2.3x)3.416 s (~8.3x)
diff --git a/docs/docs/performance.md b/docs/docs/performance.md index 45d91f3c..e561125a 100644 --- a/docs/docs/performance.md +++ b/docs/docs/performance.md @@ -11,170 +11,324 @@ Both native witness generation and proof generation are generally faster than `s However, performance varies across different circuits. We _recommend_ developers benchmark their custom circuits before selecting tools for app development. -
:::warning -- [witnesscalc](https://github.com/0xPolygonID/witnesscalc) hasn't been integrated in mopro. See [zkmopro/mopro#110](https://github.com/zkmopro/mopro/issues/110). -- [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) is not fully compatible with circom circuits. See: [zkmopro/mopro#32](https://github.com/zkmopro/mopro/issues/32). -- [wasmer](https://github.com/arkworks-rs/circom-compat) doesn't work in iOS. See: [zkmopro/mopro#109](https://github.com/zkmopro/mopro/issues/109). + +- [witnesscalc](https://github.com/0xPolygonID/witnesscalc) hasn't been integrated in mopro. See [zkmopro/mopro#110](https://github.com/zkmopro/mopro/issues/110). +- [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) is not fully compatible with circom circuits. See: [zkmopro/mopro#32](https://github.com/zkmopro/mopro/issues/32). +- [wasmer](https://github.com/arkworks-rs/circom-compat) doesn't work in iOS. See: [zkmopro/mopro#109](https://github.com/zkmopro/mopro/issues/109). +- [Tachyon](https://github.com/kroma-network/tachyon) performs well in [macOS](#macos), but we haven't integrated it in + mobile. See [zkmopro/mopro#143](https://github.com/zkmopro/mopro/issues/143) ::: ### iOS -Benchmarks on an iPhone 12 mini (2020). - -
- Witness generation - -| SHA256 | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 22.3 ms | 36.1 ms | 476.1 ms | 90.3 ms | 163.5 ms | -| Stdev | 1.2 ms | 0.3 ms | 27.8 ms | 1.2 ms | 6.7 ms | -| Comparing to snarkjs | **~7x** | ~4.5x | ~(-3)x | ~1.8 | - | - - - -| Keccak256 | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 144.7 ms | 26.2 ms | 440.7 ms | 160.7 ms | 257.1 ms | -| Stdev | 1.8 ms | 4.5 ms | 10.4 ms | 3.3 ms | 4.1 ms | -| Comparing to snarkjs | ~1.8x | **~10x** | ~(-1.7)x | ~1.6x | - | - - - -| RSA | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 208.5 ms | 513.1 ms | 5488 ms | 3861 ms | 5421 ms | -| Stdev | 5.8 ms | 11.2 ms | 47.8 ms | 10.8 ms | 9.9 ms | -| Comparing to snarkjs | **~26x** | ~10x | ~(-1)x | ~1.4x | - | - - -
- -
- Proof generation - -| SHA256 | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 795.2 ms | 550.4 ms | 2374.1 ms | -| Stdev | 17.2 ms | 27.2 ms | 62.9 ms | -| Comparing to snarkjs | ~3x | **~4.3x** | - | - - - -| Keccak256 | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2647.9 ms | 1221.1 ms | 8149.1 ms | -| Stdev | 14.4 ms | 42.7 ms | 283.575 ms | -| Comparing to snarkjs | ~3x | **~6.7x** | - | - - - -| RSA | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2908.6 ms | 2324.4 ms | 10304.8 ms | -| Stdev | 112.9 ms | 67.1 ms | 605.5 ms | -| Comparing to snarkjs | ~3.5x | **~4.4x** | - | - - -
- +Benchmarks on an iPhone 16 Pro (2024). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256142.1 ms (~1x)75.4 ms (**~2x**)287.7 ms (slower)140 ms (~1x)147.1 ms
SHA25641 ms (**~2x**)51.3 ms (~1.7x)171.3 ms (slower)93.9 ms (~1x)91.8 ms
RSA153 ms (**~19x**)-2937.5 ms (~1x)2312.3 ms (~1.2x)2979.5 ms
Semaphore22 ms (~3.5x)14.6 ms (**~5.3x**)266.5 ms (slower)38.9 ms (~2x)77.6 ms
Anon Aadhaar285.1 ms-3284.7 ms1490.8 ms-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256630.3 ms (**~8.2x**)956.9 ms (~5.4x)5182.1 ms
SHA256186.7 ms (**~8.2x**)498.6 ms (~3x)1487 ms
RSA749.1 ms (**~8.8x**)2250.8 ms (~3x)6604.5 ms
Semaphore143.3 ms (**~6.9x**)151.4 ms (~6.6x)1001.6 ms
Anon Aadhaar3131.7 ms10681.6 ms-
+:::info **Details:** [Spreadsheet of Circom benchmark (iOS)](https://docs.google.com/spreadsheets/d/1MFABmsYSUsWDmhbjleqhBXk7nkYwhu589yK-CHtRkNI/edit?usp=sharing) - -:::note - -- [Tachyon](https://github.com/kroma-network/tachyon) performs well in [macOS](#macos), but we haven't integrated it in - mobile. See [zkmopro/mopro#143](https://github.com/zkmopro/mopro/issues/143) - ::: +::: ### Android -TBD +Benchmarks on an Samsung S23 Ultra (2023). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256101.4 ms (~3x)71 ms (**~4x**)507.3 ms (slower)210.5 ms (~1.3x)292.3 ms
SHA25629 ms (**~5x**)44 ms (~3.5x)271.6 ms (slower)106.9 ms (~1.4x)157.9 ms
RSA155 ms (**~25x**)-4723 ms (slower)3751 ms (~1x)3958 ms
Semaphore10.3 ms (**~7x**)14.7 ms (~5x)416.9 ms (slower)32.8 ms (~2x)74.1 ms
Anon Aadhaar365.1 ms (**~8.7x**)-5359.6 ms (slower)2716.4 ms (~1.1x)3207.5 ms
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256743.7 ms (**~14x**)2330.4 ms (~4.7x)11096.4 ms
SHA256228.4 ms (**~15x**) 1575.2 ms (~2x)3514.8 ms
RSA950 ms (**~14x**)5839 ms (~2.3x)13442 ms
Semaphore165.8 ms (**~13x**)276.9 ms (~7.7x)2146 ms
Anon Aadhaar3394.5 ms (**~15x**)33239.2 ms (~1.5x)51546.3 ms
+:::info +**Details:** [Spreadsheet of Circom benchmark (Android)](https://docs.google.com/spreadsheets/d/1TDgL2NXxYl8UH-RZPWfWdawY0tjxf3c6l8B11_FG7Kg/edit?usp=sharing) +::: ### macOS Benchmarks on an Macbook Pro M1 Max (2021). -
- Witness generation - -| SHA256 | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 32.7 ms | 22.2 ms | 42.8 ms | 454.5 ms | 88.8 ms | 132.8 ms | -| Stdev | 0.7 ms | 5.2 ms | 2.2 ms | 26.7 ms | 1.0 ms | 1.3 ms | -| Comparing to snarkjs | ~4x | **~6x** | ~3x | ~(-3.4)x | ~1.5x | - | - - - -| Keccak256 | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 82.9 ms | 72.3 ms | 14.1 ms | 447.1 ms | 169 ms | 234.6 ms | -| Stdev | 0.2 ms | 7.7 ms | 0.8 ms | 5.9 ms | 2.0 ms | 3.2 ms | -| Comparing to snarkjs | ~2.8x | ~3x | **~16x** | ~(-1.9)x | x1.4x | - | - - - -| RSA | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 218.4 ms | 167.6 ms | 522.9 ms | 5109 ms | 3847.2 ms | 4638.8 ms | -| Stdev | 16.8 ms | 7.5 ms | 7.7 ms | 25.1 ms | 61.3 ms | 32.4 ms | -| Comparing to snarkjs | ~21.2 | **~27x** | ~8.8x | ~(-1.1)x | ~1.2x | - | - - -
- - -
- Proof generation -| SHA256 | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -| :--: | :--: | :--: | :--: | :--: | -| Average | 536.1 ms | 773.8 ms | 1137.3 ms | 1350.4 ms | -| Stdev | 10 ms | 17 ms | 127 ms | 26 ms | -| Comparing to snarkjs | **~2.5x** | ~1.7x | ~1.1 | - | - - - -| Keccak256 | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 1931 ms | 2514 ms | 1133 ms | 3791 ms | -| Stdev | 31.9 ms | 75.2 ms | 168 ms | 58.6 ms | -| Comparing to snarkjs | ~1.9x | ~1.5x | **~3.3** | - | - - - -| RSA | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2307 ms | 2560 ms | 2530 ms | 5504 ms | -| Stdev | 18.7 ms | 21.3 ms | 266.1 ms | 69.3 ms | -| Comparing to snarkjs | **~2.3** | ~2.1x | ~2.1x | - | - - -
- -**Details:** [Spreadsheet of Circom benchmark (macOS)](https://docs.google.com/spreadsheets/d/1irKg_TOP-yXms8igwCN_3OjVrtFe5gTHkuF0RbrVuho/edit?usp=sharing) -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak25663.9 ms (**~5x**)69.6 ms (~5x)507.7 ms (slower)214.6 ms (~1.6x)348.7 ms
SHA25622 ms (**~10x**)32 ms (~7x)272 ms (slower)112 ms (~2x)225 ms
RSA164 ms (**~29x**)-5326 ms (slower)4796 ms (slower)4777 ms
Semaphore7.1 ms (~18x)5 ms (**~26x**)287 ms (slower)34.9 ms (~3.7x)130 ms
Anon Aadhaar324 ms (**~10x**)-5369 ms (slower)2902 ms (~1.2x)3437 ms
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256528 ms (**~7x**)1161 ms (~3.3x)3873 ms
SHA256158 ms (**~9x**) 779 ms (~2x)1462 ms
RSA676 ms (**~8x**)3005 ms (~1.8x)5553 ms
Semaphore112 ms (~7.8x)84 ms (**~10x**)877 ms
Anon Aadhaar2421 ms (**~8x**)14142 ms (~1.3x)19794 ms
+:::info +**Details:** [Spreadsheet of Circom benchmark (host)](https://docs.google.com/spreadsheets/d/1irKg_TOP-yXms8igwCN_3OjVrtFe5gTHkuF0RbrVuho/edit?usp=sharing) +::: ## Halo2 In summary:
The performance of the Mopro build is comparable to the native Halo2 build.
-
- The bellow tests were run on a Macbook Pro M1 Pro (2021) as well as an iPhone 15 Pro (2023). | [Keccak256](https://github.com/ElusAegis/halo2-keccak-stable.git) | Prove Time (s) | Verify Time (s) | -|:-----------------------------------------------------------------:|:--------------:|:---------------:| +| :---------------------------------------------------------------: | :------------: | :-------------: | | Native (M1 Pro) | 10.3 s | 0.15 s | | Emulator (M1 Pro) | 10.1 s | 0.13 s | | iPhone 15 Pro | 11.0 s | 0.12 s | | [RSA](https://github.com/ElusAegis/halo2-rsa-mopro.git) | Prove Time (s) | Verify Time (s) | -|:-------------------------------------------------------:|:--------------:|:---------------:| +| :-----------------------------------------------------: | :------------: | :-------------: | | Native (M1 Pro) | 76.5 s | 11.1 s | | Emulator (M1 Pro) | 64.5 s | 9.0 s | | iPhone 15 Pro | crashes | crashes | Note that the iPhone 15 Pro crashes when running the RSA circuit due to the large memory requirements. The circuit needs around 5GB of memory to run, while the iPhone 15 Pro usually limits the application memory usage to 3GB. - -
\ No newline at end of file diff --git a/docs/versioned_docs/version-0.1.0/performance.md b/docs/versioned_docs/version-0.1.0/performance.md index 45d91f3c..e561125a 100644 --- a/docs/versioned_docs/version-0.1.0/performance.md +++ b/docs/versioned_docs/version-0.1.0/performance.md @@ -11,170 +11,324 @@ Both native witness generation and proof generation are generally faster than `s However, performance varies across different circuits. We _recommend_ developers benchmark their custom circuits before selecting tools for app development. -
:::warning -- [witnesscalc](https://github.com/0xPolygonID/witnesscalc) hasn't been integrated in mopro. See [zkmopro/mopro#110](https://github.com/zkmopro/mopro/issues/110). -- [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) is not fully compatible with circom circuits. See: [zkmopro/mopro#32](https://github.com/zkmopro/mopro/issues/32). -- [wasmer](https://github.com/arkworks-rs/circom-compat) doesn't work in iOS. See: [zkmopro/mopro#109](https://github.com/zkmopro/mopro/issues/109). + +- [witnesscalc](https://github.com/0xPolygonID/witnesscalc) hasn't been integrated in mopro. See [zkmopro/mopro#110](https://github.com/zkmopro/mopro/issues/110). +- [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) is not fully compatible with circom circuits. See: [zkmopro/mopro#32](https://github.com/zkmopro/mopro/issues/32). +- [wasmer](https://github.com/arkworks-rs/circom-compat) doesn't work in iOS. See: [zkmopro/mopro#109](https://github.com/zkmopro/mopro/issues/109). +- [Tachyon](https://github.com/kroma-network/tachyon) performs well in [macOS](#macos), but we haven't integrated it in + mobile. See [zkmopro/mopro#143](https://github.com/zkmopro/mopro/issues/143) ::: ### iOS -Benchmarks on an iPhone 12 mini (2020). - -
- Witness generation - -| SHA256 | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 22.3 ms | 36.1 ms | 476.1 ms | 90.3 ms | 163.5 ms | -| Stdev | 1.2 ms | 0.3 ms | 27.8 ms | 1.2 ms | 6.7 ms | -| Comparing to snarkjs | **~7x** | ~4.5x | ~(-3)x | ~1.8 | - | - - - -| Keccak256 | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 144.7 ms | 26.2 ms | 440.7 ms | 160.7 ms | 257.1 ms | -| Stdev | 1.8 ms | 4.5 ms | 10.4 ms | 3.3 ms | 4.1 ms | -| Comparing to snarkjs | ~1.8x | **~10x** | ~(-1.7)x | ~1.6x | - | - - - -| RSA | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 208.5 ms | 513.1 ms | 5488 ms | 3861 ms | 5421 ms | -| Stdev | 5.8 ms | 11.2 ms | 47.8 ms | 10.8 ms | 9.9 ms | -| Comparing to snarkjs | **~26x** | ~10x | ~(-1)x | ~1.4x | - | - - -
- -
- Proof generation - -| SHA256 | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 795.2 ms | 550.4 ms | 2374.1 ms | -| Stdev | 17.2 ms | 27.2 ms | 62.9 ms | -| Comparing to snarkjs | ~3x | **~4.3x** | - | - - - -| Keccak256 | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2647.9 ms | 1221.1 ms | 8149.1 ms | -| Stdev | 14.4 ms | 42.7 ms | 283.575 ms | -| Comparing to snarkjs | ~3x | **~6.7x** | - | - - - -| RSA | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2908.6 ms | 2324.4 ms | 10304.8 ms | -| Stdev | 112.9 ms | 67.1 ms | 605.5 ms | -| Comparing to snarkjs | ~3.5x | **~4.4x** | - | - - -
- +Benchmarks on an iPhone 16 Pro (2024). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256142.1 ms (~1x)75.4 ms (**~2x**)287.7 ms (slower)140 ms (~1x)147.1 ms
SHA25641 ms (**~2x**)51.3 ms (~1.7x)171.3 ms (slower)93.9 ms (~1x)91.8 ms
RSA153 ms (**~19x**)-2937.5 ms (~1x)2312.3 ms (~1.2x)2979.5 ms
Semaphore22 ms (~3.5x)14.6 ms (**~5.3x**)266.5 ms (slower)38.9 ms (~2x)77.6 ms
Anon Aadhaar285.1 ms-3284.7 ms1490.8 ms-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256630.3 ms (**~8.2x**)956.9 ms (~5.4x)5182.1 ms
SHA256186.7 ms (**~8.2x**)498.6 ms (~3x)1487 ms
RSA749.1 ms (**~8.8x**)2250.8 ms (~3x)6604.5 ms
Semaphore143.3 ms (**~6.9x**)151.4 ms (~6.6x)1001.6 ms
Anon Aadhaar3131.7 ms10681.6 ms-
+:::info **Details:** [Spreadsheet of Circom benchmark (iOS)](https://docs.google.com/spreadsheets/d/1MFABmsYSUsWDmhbjleqhBXk7nkYwhu589yK-CHtRkNI/edit?usp=sharing) - -:::note - -- [Tachyon](https://github.com/kroma-network/tachyon) performs well in [macOS](#macos), but we haven't integrated it in - mobile. See [zkmopro/mopro#143](https://github.com/zkmopro/mopro/issues/143) - ::: +::: ### Android -TBD +Benchmarks on an Samsung S23 Ultra (2023). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256101.4 ms (~3x)71 ms (**~4x**)507.3 ms (slower)210.5 ms (~1.3x)292.3 ms
SHA25629 ms (**~5x**)44 ms (~3.5x)271.6 ms (slower)106.9 ms (~1.4x)157.9 ms
RSA155 ms (**~25x**)-4723 ms (slower)3751 ms (~1x)3958 ms
Semaphore10.3 ms (**~7x**)14.7 ms (~5x)416.9 ms (slower)32.8 ms (~2x)74.1 ms
Anon Aadhaar365.1 ms (**~8.7x**)-5359.6 ms (slower)2716.4 ms (~1.1x)3207.5 ms
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256743.7 ms (**~14x**)2330.4 ms (~4.7x)11096.4 ms
SHA256228.4 ms (**~15x**) 1575.2 ms (~2x)3514.8 ms
RSA950 ms (**~14x**)5839 ms (~2.3x)13442 ms
Semaphore165.8 ms (**~13x**)276.9 ms (~7.7x)2146 ms
Anon Aadhaar3394.5 ms (**~15x**)33239.2 ms (~1.5x)51546.3 ms
+:::info +**Details:** [Spreadsheet of Circom benchmark (Android)](https://docs.google.com/spreadsheets/d/1TDgL2NXxYl8UH-RZPWfWdawY0tjxf3c6l8B11_FG7Kg/edit?usp=sharing) +::: ### macOS Benchmarks on an Macbook Pro M1 Max (2021). -
- Witness generation - -| SHA256 | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 32.7 ms | 22.2 ms | 42.8 ms | 454.5 ms | 88.8 ms | 132.8 ms | -| Stdev | 0.7 ms | 5.2 ms | 2.2 ms | 26.7 ms | 1.0 ms | 1.3 ms | -| Comparing to snarkjs | ~4x | **~6x** | ~3x | ~(-3.4)x | ~1.5x | - | - - - -| Keccak256 | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 82.9 ms | 72.3 ms | 14.1 ms | 447.1 ms | 169 ms | 234.6 ms | -| Stdev | 0.2 ms | 7.7 ms | 0.8 ms | 5.9 ms | 2.0 ms | 3.2 ms | -| Comparing to snarkjs | ~2.8x | ~3x | **~16x** | ~(-1.9)x | x1.4x | - | - - - -| RSA | [Tachyon](https://github.com/kroma-network/tachyon) | [witnesscalc](https://github.com/0xPolygonID/witnesscalc) | [circom-witness-rs](https://github.com/philsippl/circom-witness-rs) | [wasmer](https://github.com/arkworks-rs/circom-compat) | [w2c](https://github.com/vimwitch/rust-witness) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------------------------------:|:------------------------------------------------------:|:-----------------------------------------------:|:-------------------------------------------:| -| Average | 218.4 ms | 167.6 ms | 522.9 ms | 5109 ms | 3847.2 ms | 4638.8 ms | -| Stdev | 16.8 ms | 7.5 ms | 7.7 ms | 25.1 ms | 61.3 ms | 32.4 ms | -| Comparing to snarkjs | ~21.2 | **~27x** | ~8.8x | ~(-1.1)x | ~1.2x | - | - - -
- - -
- Proof generation -| SHA256 | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -| :--: | :--: | :--: | :--: | :--: | -| Average | 536.1 ms | 773.8 ms | 1137.3 ms | 1350.4 ms | -| Stdev | 10 ms | 17 ms | 127 ms | 26 ms | -| Comparing to snarkjs | **~2.5x** | ~1.7x | ~1.1 | - | - - - -| Keccak256 | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 1931 ms | 2514 ms | 1133 ms | 3791 ms | -| Stdev | 31.9 ms | 75.2 ms | 168 ms | 58.6 ms | -| Comparing to snarkjs | ~1.9x | ~1.5x | **~3.3** | - | - - - -| RSA | [Tachyon](https://github.com/kroma-network/tachyon) | [rapidsnark](https://github.com/iden3/rapidsnark) | [ark-works](https://github.com/arkworks-rs/circom-compat) | [snarkjs](https://github.com/iden3/snarkjs) | -|:--------------------:|:---------------------------------------------------:|:-------------------------------------------------:|:---------------------------------------------------------:|:-------------------------------------------:| -| Average | 2307 ms | 2560 ms | 2530 ms | 5504 ms | -| Stdev | 18.7 ms | 21.3 ms | 266.1 ms | 69.3 ms | -| Comparing to snarkjs | **~2.3** | ~2.1x | ~2.1x | - | - - -
- -**Details:** [Spreadsheet of Circom benchmark (macOS)](https://docs.google.com/spreadsheets/d/1irKg_TOP-yXms8igwCN_3OjVrtFe5gTHkuF0RbrVuho/edit?usp=sharing) -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Witness generation[witnesscalc](https://github.com/0xPolygonID/witnesscalc)[circom-witnesscalc](https://github.com/iden3/circom-witnesscalc)[wasmer](https://github.com/arkworks-rs/circom-compat)[w2c](https://github.com/vimwitch/rust-witness)[snarkjs](https://github.com/iden3/snarkjs)
Keccak25663.9 ms (**~5x**)69.6 ms (~5x)507.7 ms (slower)214.6 ms (~1.6x)348.7 ms
SHA25622 ms (**~10x**)32 ms (~7x)272 ms (slower)112 ms (~2x)225 ms
RSA164 ms (**~29x**)-5326 ms (slower)4796 ms (slower)4777 ms
Semaphore7.1 ms (~18x)5 ms (**~26x**)287 ms (slower)34.9 ms (~3.7x)130 ms
Anon Aadhaar324 ms (**~10x**)-5369 ms (slower)2902 ms (~1.2x)3437 ms
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Proof generation[rapidsnark](https://github.com/iden3/rapidsnark)[ark-works](https://github.com/arkworks-rs/circom-compat)[snarkjs](https://github.com/iden3/snarkjs)
Keccak256528 ms (**~7x**)1161 ms (~3.3x)3873 ms
SHA256158 ms (**~9x**) 779 ms (~2x)1462 ms
RSA676 ms (**~8x**)3005 ms (~1.8x)5553 ms
Semaphore112 ms (~7.8x)84 ms (**~10x**)877 ms
Anon Aadhaar2421 ms (**~8x**)14142 ms (~1.3x)19794 ms
+:::info +**Details:** [Spreadsheet of Circom benchmark (host)](https://docs.google.com/spreadsheets/d/1irKg_TOP-yXms8igwCN_3OjVrtFe5gTHkuF0RbrVuho/edit?usp=sharing) +::: ## Halo2 In summary:
The performance of the Mopro build is comparable to the native Halo2 build.
-
- The bellow tests were run on a Macbook Pro M1 Pro (2021) as well as an iPhone 15 Pro (2023). | [Keccak256](https://github.com/ElusAegis/halo2-keccak-stable.git) | Prove Time (s) | Verify Time (s) | -|:-----------------------------------------------------------------:|:--------------:|:---------------:| +| :---------------------------------------------------------------: | :------------: | :-------------: | | Native (M1 Pro) | 10.3 s | 0.15 s | | Emulator (M1 Pro) | 10.1 s | 0.13 s | | iPhone 15 Pro | 11.0 s | 0.12 s | | [RSA](https://github.com/ElusAegis/halo2-rsa-mopro.git) | Prove Time (s) | Verify Time (s) | -|:-------------------------------------------------------:|:--------------:|:---------------:| +| :-----------------------------------------------------: | :------------: | :-------------: | | Native (M1 Pro) | 76.5 s | 11.1 s | | Emulator (M1 Pro) | 64.5 s | 9.0 s | | iPhone 15 Pro | crashes | crashes | Note that the iPhone 15 Pro crashes when running the RSA circuit due to the large memory requirements. The circuit needs around 5GB of memory to run, while the iPhone 15 Pro usually limits the application memory usage to 3GB. - -
\ No newline at end of file