The proving function of zkSNARK is a heavy operation, where most of the time is spend doing curve arithmetic (of G1 and G2). This implementation uses the cloudflare bn256 library for curve arithmetic, which is implemented using 64bit arithmetic underneath. Probably because of this, curve operations are extremely slow in 32 bit architectures. Here are the times to run the tests in my machine in 64 bit mode and in 32 bit mode:
64 bits
$ go test -count=1 -v ./...
[...]
ok github.com/iden3/go-circom-prover-verifier/parsers 13.254s
=== RUN TestTableG1
Std. Mult. time elapsed: 438.584947ms
Gsize : 2, TMult time elapsed: 915.126384ms
Gsize : 2, TMult time elapsed (inc table comp): 1.213457219s
Gsize : 2, TMultNoDouble time elapsed: 341.2983ms
Gsize : 2, TMultNoDouble time elapsed (inc table comp): 632.191658ms
Gsize : 3, TMult time elapsed: 759.214912ms
Gsize : 3, TMult time elapsed (inc table comp): 924.800086ms
Gsize : 3, TMultNoDouble time elapsed: 277.597828ms
Gsize : 3, TMultNoDouble time elapsed (inc table comp): 422.592558ms
Gsize : 4, TMult time elapsed: 584.80472ms
Gsize : 4, TMult time elapsed (inc table comp): 655.952171ms
Gsize : 4, TMultNoDouble time elapsed: 224.249583ms
Gsize : 4, TMultNoDouble time elapsed (inc table comp): 303.600261ms
Gsize : 5, TMult time elapsed: 525.401673ms
Gsize : 5, TMult time elapsed (inc table comp): 515.770472ms
Gsize : 5, TMultNoDouble time elapsed: 189.253744ms
Gsize : 5, TMultNoDouble time elapsed (inc table comp): 311.084845ms
Gsize : 6, TMult time elapsed: 332.03667ms
Gsize : 6, TMult time elapsed (inc table comp): 435.044513ms
Gsize : 6, TMultNoDouble time elapsed: 147.442104ms
Gsize : 6, TMultNoDouble time elapsed (inc table comp): 257.784684ms
Gsize : 7, TMult time elapsed: 348.90964ms
Gsize : 7, TMult time elapsed (inc table comp): 389.650717ms
Gsize : 7, TMultNoDouble time elapsed: 119.082985ms
Gsize : 7, TMultNoDouble time elapsed (inc table comp): 227.385594ms
Gsize : 8, TMult time elapsed: 263.616921ms
Gsize : 8, TMult time elapsed (inc table comp): 389.701161ms
Gsize : 8, TMultNoDouble time elapsed: 123.689786ms
Gsize : 8, TMultNoDouble time elapsed (inc table comp): 263.211588ms
Gsize : 9, TMult time elapsed: 233.545862ms
Gsize : 9, TMult time elapsed (inc table comp): 470.544039ms
Gsize : 9, TMultNoDouble time elapsed: 131.269396ms
Gsize : 9, TMultNoDouble time elapsed (inc table comp): 329.770357ms
--- PASS: TestTableG1 (23.70s)
=== RUN TestTableG2
Std. Mult. time elapsed: 2.327429554s
Gsize : 2, TMult time elapsed: 2.365026366s
Gsize : 2, TMult time elapsed (inc table comp): 2.363508946s
Gsize : 2, TMultNoDouble time elapsed: 987.885293ms
Gsize : 2, TMultNoDouble time elapsed (inc table comp): 1.026393573s
Gsize : 3, TMult time elapsed: 1.675419356s
Gsize : 3, TMult time elapsed (inc table comp): 1.81313444s
Gsize : 3, TMultNoDouble time elapsed: 936.400235ms
Gsize : 3, TMultNoDouble time elapsed (inc table comp): 863.277955ms
Gsize : 4, TMult time elapsed: 1.362177193s
Gsize : 4, TMult time elapsed (inc table comp): 1.339378334s
Gsize : 4, TMultNoDouble time elapsed: 605.848893ms
Gsize : 4, TMultNoDouble time elapsed (inc table comp): 664.150672ms
Gsize : 5, TMult time elapsed: 1.071811394s
Gsize : 5, TMult time elapsed (inc table comp): 1.116475522s
Gsize : 5, TMultNoDouble time elapsed: 501.307834ms
Gsize : 5, TMultNoDouble time elapsed (inc table comp): 553.500146ms
Gsize : 6, TMult time elapsed: 883.072678ms
Gsize : 6, TMult time elapsed (inc table comp): 1.018539561s
Gsize : 6, TMultNoDouble time elapsed: 477.702989ms
Gsize : 6, TMultNoDouble time elapsed (inc table comp): 549.024736ms
Gsize : 7, TMult time elapsed: 765.399254ms
Gsize : 7, TMult time elapsed (inc table comp): 983.373491ms
Gsize : 7, TMultNoDouble time elapsed: 393.036241ms
Gsize : 7, TMultNoDouble time elapsed (inc table comp): 573.739532ms
Gsize : 8, TMult time elapsed: 712.589476ms
Gsize : 8, TMult time elapsed (inc table comp): 1.153093172s
Gsize : 8, TMultNoDouble time elapsed: 396.031226ms
Gsize : 8, TMultNoDouble time elapsed (inc table comp): 738.545117ms
Gsize : 9, TMult time elapsed: 665.171671ms
Gsize : 9, TMult time elapsed (inc table comp): 1.289324771s
Gsize : 9, TMultNoDouble time elapsed: 305.266214ms
Gsize : 9, TMultNoDouble time elapsed (inc table comp): 921.248535ms
--- PASS: TestTableG2 (37.54s)
=== RUN TestCircuitsGenerateProof
proof generation time for circuit1k elapsed: 313.974817ms
proof generation time for circuit5k elapsed: 765.826032ms
--- PASS: TestCircuitsGenerateProof (3.84s)
PASS
ok github.com/iden3/go-circom-prover-verifier/prover 65.096s
? github.com/iden3/go-circom-prover-verifier/types [no test files]
=== RUN TestVerify
--- PASS: TestVerify (0.03s)
PASS
ok github.com/iden3/go-circom-prover-verifier/verifier 0.036s
32 bits
$ GOARCH=386 CGO_ENABLED=1 go test -timeout=100m -count=1 -v ./...
[...]
=== RUN TestGoCircomPkFormat
--- PASS: TestGoCircomPkFormat (259.25s)
PASS
ok github.com/iden3/go-circom-prover-verifier/parsers 507.562s
=== RUN TestTableG1
Std. Mult. time elapsed: 25.229547162s
Gsize : 2, TMult time elapsed: 46.902666973s
Gsize : 2, TMult time elapsed (inc table comp): 54.660849175s
Gsize : 2, TMultNoDouble time elapsed: 14.651216208s
Gsize : 2, TMultNoDouble time elapsed (inc table comp): 24.853671405s
Gsize : 3, TMult time elapsed: 33.166766065s
Gsize : 3, TMult time elapsed (inc table comp): 41.977544724s
Gsize : 3, TMultNoDouble time elapsed: 12.970824732s
Gsize : 3, TMultNoDouble time elapsed (inc table comp): 20.721264448s
Gsize : 4, TMult time elapsed: 23.803797865s
Gsize : 4, TMult time elapsed (inc table comp): 32.920558735s
Gsize : 4, TMultNoDouble time elapsed: 10.805525639s
Gsize : 4, TMultNoDouble time elapsed (inc table comp): 14.599792368s
Gsize : 5, TMult time elapsed: 21.035002562s
Gsize : 5, TMult time elapsed (inc table comp): 26.53175353s
Gsize : 5, TMultNoDouble time elapsed: 8.278354744s
Gsize : 5, TMultNoDouble time elapsed (inc table comp): 13.724552412s
Gsize : 6, TMult time elapsed: 15.245426857s
Gsize : 6, TMult time elapsed (inc table comp): 18.043479064s
Gsize : 6, TMultNoDouble time elapsed: 5.883385987s
Gsize : 6, TMultNoDouble time elapsed (inc table comp): 10.03122343s
Gsize : 7, TMult time elapsed: 12.136987036s
Gsize : 7, TMult time elapsed (inc table comp): 16.02080437s
Gsize : 7, TMultNoDouble time elapsed: 5.749899908s
Gsize : 7, TMultNoDouble time elapsed (inc table comp): 10.012414947s
Gsize : 8, TMult time elapsed: 11.334874233s
Gsize : 8, TMult time elapsed (inc table comp): 18.805785598s
Gsize : 8, TMultNoDouble time elapsed: 4.973998312s
Gsize : 8, TMultNoDouble time elapsed (inc table comp): 12.037670542s
Gsize : 9, TMult time elapsed: 9.98482576s
Gsize : 9, TMult time elapsed (inc table comp): 18.23841386s
Gsize : 9, TMultNoDouble time elapsed: 4.497162014s
Gsize : 9, TMultNoDouble time elapsed (inc table comp): 15.009669233s
--- PASS: TestTableG1 (1118.09s)
=== RUN TestTableG2
Std. Mult. time elapsed: 1m43.381553635s
Gsize : 2, TMult time elapsed: 1m42.019688314s
Gsize : 2, TMult time elapsed (inc table comp): 1m50.277204657s
Gsize : 2, TMultNoDouble time elapsed: 47.795616s
Gsize : 2, TMultNoDouble time elapsed (inc table comp): 42.222510439s
Gsize : 3, TMult time elapsed: 1m16.272836431s
Gsize : 3, TMult time elapsed (inc table comp): 1m18.13068509s
Gsize : 3, TMultNoDouble time elapsed: 36.074068916s
Gsize : 3, TMultNoDouble time elapsed (inc table comp): 37.160906744s
Gsize : 4, TMult time elapsed: 1m0.158995216s
Gsize : 4, TMult time elapsed (inc table comp): 56.462133224s
Gsize : 4, TMultNoDouble time elapsed: 28.000110501s
Gsize : 4, TMultNoDouble time elapsed (inc table comp): 31.032537053s
Gsize : 5, TMult time elapsed: 50.312886853s
Gsize : 5, TMult time elapsed (inc table comp): 54.072934236s
Gsize : 5, TMultNoDouble time elapsed: 25.038418478s
Gsize : 5, TMultNoDouble time elapsed (inc table comp): 29.315277339s
Gsize : 6, TMult time elapsed: 46.634310582s
Gsize : 6, TMult time elapsed (inc table comp): 52.10397989s
Gsize : 6, TMultNoDouble time elapsed: 21.502104022s
Gsize : 6, TMultNoDouble time elapsed (inc table comp): 27.691369479s
Gsize : 7, TMult time elapsed: 36.985655141s
Gsize : 7, TMult time elapsed (inc table comp): 45.627397954s
Gsize : 7, TMultNoDouble time elapsed: 17.847018278s
Gsize : 7, TMultNoDouble time elapsed (inc table comp): 24.213088009s
Gsize : 8, TMult time elapsed: 30.888659668s
Gsize : 8, TMult time elapsed (inc table comp): 51.530030582s
Gsize : 8, TMultNoDouble time elapsed: 16.008177039s
Gsize : 8, TMultNoDouble time elapsed (inc table comp): 33.329923663s
Gsize : 9, TMult time elapsed: 30.698162791s
Gsize : 9, TMult time elapsed (inc table comp): 1m1.491678455s
Gsize : 9, TMultNoDouble time elapsed: 15.227667236s
Gsize : 9, TMultNoDouble time elapsed (inc table comp): 46.668766567s
--- PASS: TestTableG2 (1703.87s)
=== RUN TestCircuitsGenerateProof
proof generation time for circuit1k elapsed: 18.095089134s
proof generation time for circuit5k elapsed: 39.729382597s
--- PASS: TestCircuitsGenerateProof (180.54s)
PASS
ok github.com/iden3/go-circom-prover-verifier/prover 3002.511s
? github.com/iden3/go-circom-prover-verifier/types [no test files]
=== RUN TestVerify
--- PASS: TestVerify (0.84s)
PASS
ok github.com/iden3/go-circom-prover-verifier/verifier 0.842s
Summary of 32 bits tests:
prover: 46 times slower than 64 bits
parser: 38 times slower than 64 bits
This means that for now 32 bit architectures will get a very degraded performance.
Note: This is an informative issue.
The proving function of zkSNARK is a heavy operation, where most of the time is spend doing curve arithmetic (of G1 and G2). This implementation uses the cloudflare bn256 library for curve arithmetic, which is implemented using 64bit arithmetic underneath. Probably because of this, curve operations are extremely slow in 32 bit architectures. Here are the times to run the tests in my machine in 64 bit mode and in 32 bit mode:
64 bits
32 bits
Summary of 32 bits tests:
This means that for now 32 bit architectures will get a very degraded performance.