Circuit: #gates=7366376 (XOR=3146111 AND=3133757 OR=1032350 INV=54158)
┏━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 10.72622192s ┃ 75.33% ┃ ┃
┃ Recv ┃ 2.501608027s ┃ 17.57% ┃ 364MB ┃
┃ Inputs ┃ 232.257386ms ┃ 1.63% ┃ 41kB ┃
┃ Eval ┃ 778.170361ms ┃ 5.47% ┃ ┃
┃ Result ┃ 158.838µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 14.238416532s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Optimized full-adder:
Circuit: #gates=7366376 (XOR=5210811 AND=2101407 OR=0 INV=54158)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 7.9561241s ┃ 76.09% ┃ ┃
┃ Recv ┃ 1.660386022s ┃ 15.88% ┃ 199MB ┃
┃ Inputs ┃ 232.583145ms ┃ 2.22% ┃ 41kB ┃
┃ Eval ┃ 606.479521ms ┃ 5.80% ┃ ┃
┃ Result ┃ 304.202µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 10.45587699s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Karatsuba multiplication algorithm:
Circuit: #gates=6822632 (XOR=4828475 XNOR=58368 AND=1874719 OR=0 INV=61070)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 6.672590283s ┃ 75.99% ┃ ┃
┃ Recv ┃ 1.320621876s ┃ 15.04% ┃ 179MB ┃
┃ Inputs ┃ 231.659961ms ┃ 2.64% ┃ 41kB ┃
┃ Eval ┃ 555.192105ms ┃ 6.32% ┃ ┃
┃ Result ┃ 298.855µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 8.78036308s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Optimized INV-gates:
Circuit: #gates=6769820 (XOR=4836732 XNOR=58368 AND=1874719 OR=0 INV=1)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 6.338729612s ┃ 75.20% ┃ ┃
┃ Recv ┃ 1.352880139s ┃ 16.05% ┃ 177MB ┃
┃ Inputs ┃ 227.12815ms ┃ 2.69% ┃ 41kB ┃
┃ Eval ┃ 509.574258ms ┃ 6.05% ┃ ┃
┃ Result ┃ 344.425µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 8.428656584s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Labels by value:
Circuit: #gates=6717340 (XOR=4787324 XNOR=108545 AND=1821471 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 6.117743762s ┃ 77.25% ┃ ┃
┃ Recv ┃ 1.196140342s ┃ 15.10% ┃ 172MB ┃
┃ Inputs ┃ 236.647371ms ┃ 2.99% ┃ 41kB ┃
┃ Eval ┃ 368.944904ms ┃ 4.66% ┃ ┃
┃ Result ┃ 347.483µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 7.919823862s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Labels by value in protocol, garbler, and evaluator:
Circuit: #gates=6717340 (XOR=4787324 XNOR=108545 AND=1821471 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 5.076677475s ┃ 78.67% ┃ ┃
┃ Recv ┃ 940.758975ms ┃ 14.58% ┃ 143MB ┃
┃ Inputs ┃ 229.741398ms ┃ 3.56% ┃ 41kB ┃
┃ Eval ┃ 205.513944ms ┃ 3.18% ┃ ┃
┃ Result ┃ 185.197µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 6.452876989s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Gate wires by value in garbler:
Circuit: #gates=6717340 (XOR=4787324 XNOR=108545 AND=1821471 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 4.37061338s ┃ 76.48% ┃ ┃
┃ Recv ┃ 962.20669ms ┃ 16.84% ┃ 143MB ┃
┃ Inputs ┃ 229.360283ms ┃ 4.01% ┃ 41kB ┃
┃ Eval ┃ 152.258636ms ┃ 2.66% ┃ ┃
┃ Result ┃ 162.316µs ┃ 0.00% ┃ 1kB ┃
┃ Total ┃ 5.714601305s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Garbler keeping wires in an array instead of map:
Circuit: #gates=6717340 (XOR=4787324 XNOR=108545 AND=1821471 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 1.710655914s ┃ 53.63% ┃ ┃
┃ Recv ┃ 1.088403425s ┃ 34.12% ┃ 143MB ┃
┃ Inputs ┃ 243.393526ms ┃ 7.63% ┃ 41kB ┃
┃ Eval ┃ 146.879726ms ┃ 4.61% ┃ ┃
┃ Result ┃ 222.8µs ┃ 0.01% ┃ 1kB ┃
┃ Total ┃ 3.189555391s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Pruning dead gates:
Circuit: #gates=5972956 (XOR=4315452 XNOR=53761 AND=1603743 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 1.28140619s ┃ 55.30% ┃ ┃
┃ Recv ┃ 676.432166ms ┃ 29.19% ┃ 126MB ┃
┃ Inputs ┃ 229.527559ms ┃ 9.91% ┃ 41kB ┃
┃ Eval ┃ 129.623668ms ┃ 5.59% ┃ ┃
┃ Result ┃ 203.248µs ┃ 0.01% ┃ 1kB ┃
┃ Total ┃ 2.317192831s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Optimized garbling:
Circuit: #gates=5972956 (XOR=4315452 XNOR=53761 AND=1603743 OR=0 INV=0)
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┣━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━┫
┃ Wait ┃ 700.031233ms ┃ 38.57% ┃ ┃
┃ Recv ┃ 706.339086ms ┃ 38.92% ┃ 126MB ┃
┃ Inputs ┃ 233.615365ms ┃ 12.87% ┃ 41kB ┃
┃ Eval ┃ 174.84741ms ┃ 9.63% ┃ ┃
┃ Result ┃ 215.733µs ┃ 0.01% ┃ 1kB ┃
┃ Total ┃ 1.815048827s ┃ ┃ ┃
┗━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━┛
Optimized dynamic memory allocations from garbling:
Circuit: #gates=5972956 (XOR=4315452 XNOR=53761 AND=1603743 OR=0 INV=0) #w=5973116
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Wait │ 574.859679ms │ 35.11% │ │
│ Recv │ 678.520719ms │ 41.44% │ 126MB │
│ Inputs │ 274.49709ms │ 16.77% │ 41kB │
│ Eval │ 109.1673ms │ 6.67% │ │
│ Result │ 158.416µs │ 0.01% │ 1kB │
│ Total │ 1.637203204s │ │ 126MB │
└────────┴──────────────┴────────┴───────┘
Half And optimization:
Circuit: #gates=5972956 (XOR=4315452 XNOR=53761 AND=1603743 OR=0 INV=0) #w=5973116
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Wait │ 653.959737ms │ 50.33% │ │
│ Recv │ 218.966485ms │ 16.85% │ 75MB │
│ Inputs │ 255.00393ms │ 19.63% │ 41kB │
│ Eval │ 171.306681ms │ 13.18% │ │
│ Result │ 131.077µs │ 0.01% │ 1kB │
│ Total │ 1.29936791s │ │ 75MB │
└────────┴──────────────┴────────┴──────┘
Circuit constant propagation:
Circuit: #gates=5539148 (XOR=3996414 XNOR=48825 AND=1493909 OR=0 INV=0) #w=5539308
┏━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Wait │ 672.421083ms │ 52.54% │ │
│ Recv │ 218.976021ms │ 17.11% │ 69MB │
│ Inputs │ 258.380313ms │ 20.19% │ 41kB │
│ Eval │ 129.760304ms │ 10.14% │ │
│ Result │ 182.268µs │ 0.01% │ 1kB │
│ Total │ 1.279719989s │ │ 70MB │
└────────┴──────────────┴────────┴──────┘
CO OT:
Circuit: #gates=5539117 (XOR=3996381 XNOR=48824 AND=1493910 OR=1 INV=1 xor=4045205 !xor=1493912 levels=1604812 width=8259) #w=5539277
┌────────┬──────────────┬────────┬──────┐
│ Op │ Time │ % │ Xfer │
├────────┼──────────────┼────────┼──────┤
│ Wait │ 544.037201ms │ 69.10% │ │
│ Recv │ 119.178002ms │ 15.14% │ 69MB │
│ Inputs │ 5.523428ms │ 0.70% │ 3kB │
│ Eval │ 118.35074ms │ 15.03% │ │
│ Result │ 241.858µs │ 0.03% │ 1kB │
│ Total │ 787.331229ms │ │ 69MB │
└────────┴──────────────┴────────┴──────┘
The first signature computation without SHA-512:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Init │ 141.651µs │ 0.00% │ 276B │
│ OT Init │ 243.714662ms │ 0.06% │ 264B │
│ Peer Inputs │ 69.857046ms │ 0.02% │ 10kB │
│ Eval │ 6m55.975310366s │ 99.92% │ 25GB │
│ Total │ 6m56.289023725s │ │ 25GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 43786395, cached circuits: 26
#gates=935552365, #non-XOR=291882258
Optimized p2p.Conn.SendUint{16,32}() not to allocate memory:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Init │ 41.043µs │ 0.00% │ 276B │
│ OT Init │ 166.70528ms │ 0.07% │ 264B │
│ Peer Inputs │ 66.153689ms │ 0.03% │ 10kB │
│ Eval │ 3m48.820978578s │ 99.90% │ 25GB │
│ Total │ 3m49.05387859s │ │ 25GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 43786395, cached circuits: 26
#gates=935552365, #non-XOR=291882258
Added one missing ed25519.ScReduce() (+1220540 gates, +381217 non-XOR gates):
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Init │ 64.159µs │ 0.00% │ 276B │
│ OT Init │ 317.026065ms │ 0.14% │ 264B │
│ Peer Inputs │ 66.088379ms │ 0.03% │ 10kB │
│ Eval │ 3m46.188650399s │ 99.83% │ 25GB │
│ Total │ 3m46.571829002s │ │ 25GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 43892147, cached circuits: 26
#gates=936772905, #non-XOR=292263475
Optimizing p2p.Conn.SendLabel() not to allocate memory:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Init │ 73.349µs │ 0.00% │ 276B │
│ OT Init │ 231.818904ms │ 0.13% │ 264B │
│ Peer Inputs │ 67.641816ms │ 0.04% │ 10kB │
│ Eval │ 2m57.583645976s │ 99.83% │ 25GB │
│ Total │ 2m57.883180045s │ │ 25GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 43892147, cached circuits: 26
#gates=936772905, #non-XOR=292263475
Optimizing circuit.decrypt() not to allocate memory:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━┩
│ Init │ 72.412µs │ 0.00% │ 276B │
│ OT Init │ 201.50279ms │ 0.12% │ 264B │
│ Peer Inputs │ 66.133977ms │ 0.04% │ 10kB │
│ Eval │ 2m43.437916872s │ 99.84% │ 25GB │
│ Total │ 2m43.705626051s │ │ 25GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 43893683, cached circuits: 26
#gates=936737641, #non-XOR=292263475
Added SHA-512 computation:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 209.487µs │ 0.00% │ 16kB │
│ OT Init │ 97.139359ms │ 0.06% │ 264B │
│ Peer Inputs │ 4.195529436s │ 2.56% │ 667kB │
│ Eval │ 2m39.404971518s │ 97.38% │ 26GB │
│ Total │ 2m43.6978498s │ │ 26GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 45442203, cached circuits: 29
#gates=938232660 (XOR=616081537 XNOR=29253505 AND=292519636 OR=363144 INV=14838) #w=968139480
The first correct Ed25519 signature:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 1.204858ms │ 0.00% │ 20kB │
│ OT Init │ 171.049292ms │ 0.10% │ 264B │
│ Peer Inputs │ 4.186015741s │ 2.37% │ 667kB │
│ Eval │ 2m52.585569971s │ 97.54% │ 26GB │
│ Total │ 2m56.943839862s │ │ 26GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53771683, cached circuits: 29
#gates=938713349 (XOR=616368261 XNOR=29253505 AND=292577583 OR=494216 INV=19784) #w=968883849
Optimized smov
and srshift
instructions:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 213.214µs │ 0.00% │ 16kB │
│ OT Init │ 188.070588ms │ 0.12% │ 264B │
│ Peer Inputs │ 4.129665419s │ 2.60% │ 667kB │
│ Eval │ 2m34.291433121s │ 97.28% │ 25GB │
│ Total │ 2m38.609382342s │ │ 25GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53770978, cached circuits: 26
#gates=932823577 (XOR=612421393 XNOR=29253505 AND=290634679 OR=494216 INV=19784) #w=956830643
Increased p2p bufio buffer size to 1024 * 1024
and optimized wire
slice allocations in compiler/ssa/streamer.go
:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 175.567µs │ 0.00% │ 16kB │
│ OT Init │ 82.231558ms │ 0.06% │ 264B │
│ Peer Inputs │ 4.117307505s │ 3.23% │ 667kB │
│ Eval │ 2m3.276233546s │ 96.71% │ 25GB │
│ Total │ 2m7.475948176s │ │ 25GB │
└─────────────┴────────────────┴────────┴───────┘
Max permanent wires: 53770978, cached circuits: 26
#gates=932823577 (XOR=612421393 XNOR=29253505 AND=290634679 OR=494216 INV=19784) #w=956830643
Optimized p2p writer and reader:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 166.41µs │ 0.00% │ 0B │
│ OT Init │ 409.906284ms │ 0.39% │ 16kB │
│ Peer Inputs │ 4.137928557s │ 3.91% │ 667kB │
│ Eval │ 1m41.187033817s │ 95.70% │ 25GB │
│ Total │ 1m45.735035068s │ │ 25GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53770978, cached circuits: 26
#gates=932823577 (XOR=612421393 XNOR=29253505 AND=290634679 OR=494216 INV=19784) #w=956830643
Half AND:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 165.871µs │ 0.00% │ 0B │
│ OT Init │ 219.979136ms │ 0.21% │ 16kB │
│ Peer Inputs │ 4.091995195s │ 3.94% │ 667kB │
│ Eval │ 1m39.488931885s │ 95.85% │ 16GB │
│ Total │ 1m43.801072087s │ │ 16GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53770978, cached circuits: 26
#gates=932823577 (XOR=612421393 XNOR=29253505 AND=290634679 OR=494216 INV=19784) #w=956830643
Fastpath:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 173.549µs │ 0.00% │ 0B │
│ OT Init │ 104.099457ms │ 0.11% │ 16kB │
│ Peer Inputs │ 4.086109869s │ 4.38% │ 667kB │
│ Eval │ 1m29.111191227s │ 95.51% │ 16GB │
│ Total │ 1m33.301574102s │ │ 16GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53770978, cached circuits: 26
#gates=932823577 (XOR=612421393 XNOR=29253505 AND=290634679 OR=494216 INV=19784) #w=956830643
Circuit constant propagation:
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Op ┃ Time ┃ % ┃ Xfer ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ Init │ 1.272423ms │ 0.00% │ 0B │
│ OT Init │ 176.148754ms │ 0.20% │ 16kB │
│ Peer Inputs │ 4.10966228s │ 4.57% │ 667kB │
│ Eval │ 1m25.673832556s │ 95.23% │ 15GB │
│ Total │ 1m29.960916013s │ │ 15GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53768930, cached circuits: 26
#gates=844095703 (XOR=542214087 XNOR=29105707 AND=272261909 OR=494216 INV=19784) #w=868102769
Compiler optimizations:
┌─────────────┬─────────────────┬────────┬───────┐
│ Op │ Time │ % │ Xfer │
├─────────────┼─────────────────┼────────┼───────┤
│ Compile │ 2.257813981s │ 2.57% │ │
│ Init │ 1.681455ms │ 0.00% │ 0B │
│ OT Init │ 281.670059ms │ 0.32% │ 16kB │
│ Peer Inputs │ 4.026191293s │ 4.58% │ 667kB │
│ Garble │ 1m21.278656046s │ 92.52% │ 15GB │
│ Result │ 1.402231ms │ 0.00% │ 8kB │
│ Total │ 1m27.847415065s │ │ 15GB │
└─────────────┴─────────────────┴────────┴───────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830082709 (XOR=533261481 XNOR=28815787 AND=267491441 OR=494216 INV=19784 xor=562077268 !xor=268005441 levels=10548 width=1796) #w=853799279
Parallel garbling/write:
┌─────────────┬─────────────────┬────────┬───────┐
│ Op │ Time │ % │ Xfer │
├─────────────┼─────────────────┼────────┼───────┤
│ Compile │ 2.30262394s │ 2.83% │ │
│ Init │ 1.752775ms │ 0.00% │ 0B │
│ OT Init │ 64.949902ms │ 0.08% │ 0B │
│ Peer Inputs │ 4.064791311s │ 4.99% │ 684kB │
│ Garble │ 1m15.021796109s │ 92.10% │ 15GB │
│ Result │ 3.844879ms │ 0.00% │ 17kB │
│ Total │ 1m21.459758916s │ │ 15GB │
└─────────────┴─────────────────┴────────┴───────┘
CO OT:
┌─────────────┬─────────────────┬────────┬──────┐
│ Op │ Time │ % │ Xfer │
├─────────────┼─────────────────┼────────┼──────┤
│ Compile │ 2.192778168s │ 2.82% │ │
│ Init │ 2.127053ms │ 0.00% │ 0B │
│ OT Init │ 10.404µs │ 0.00% │ 0B │
│ Peer Inputs │ 86.187868ms │ 0.11% │ 74kB │
│ Garble │ 1m15.571077934s │ 97.07% │ 15GB │
│ Result │ 338.085µs │ 0.00% │ 55kB │
│ Total │ 1m17.852519512s │ │ 15GB │
└─────────────┴─────────────────┴────────┴──────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796)
#w=853882864
Optimized compiler/circuits/Wire
data structure:
┌─────────────┬─────────────────┬─────────┬────────┐
│ Op │ Time │ % │ Xfer │
├─────────────┼─────────────────┼─────────┼────────┤
│ Compile │ 2.179716097s │ 2.90% │ │
│ Init │ 2.321499ms │ 0.00% │ 0B │
│ OT Init │ 8.833µs │ 0.00% │ 16kB │
│ Peer Inputs │ 43.987663ms │ 0.06% │ 57kB │
│ Garble │ 1m12.830374104s │ 97.03% │ 15GB │
│ Result │ 431.631µs │ 0.00% │ 8kB │
│ Total │ 1m15.056839827s │ │ 15GB │
│ ├╴Sent │ │ 100.00% │ 15GB │
│ ├╴Rcvd │ │ 0.00% │ 45kB │
│ ╰╴Flcd │ │ │ 231284 │
└─────────────┴─────────────────┴─────────┴────────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796) #w=853882864
Changes:
- changed
compiler/circuits/MakeWires
to allocate wires as one continuous array - Go 1.21.0
- Added
apps/garbled/default.pgo
┌──────────────┬─────────────────┬─────────┬────────┐
│ Op │ Time │ % │ Xfer │
├──────────────┼─────────────────┼─────────┼────────┤
│ Compile │ 2.201645057s │ 3.09% │ │
│ Init │ 2.355373ms │ 0.00% │ 0B │
│ OT Init │ 7.79µs │ 0.00% │ 16kB │
│ Peer Inputs │ 43.485891ms │ 0.06% │ 57kB │
│ Stream │ 1m8.95812062s │ 96.84% │ 15GB │
│ ├╴InstrInit │ 4.142664938s │ 6.01% │ │
│ ├╴CircComp │ 33.135987ms │ 0.05% │ │
│ ├╴StreamInit │ 2.519242464s │ 3.65% │ │
│ ╰╴Garble │ 1m1.343566909s │ 88.96% │ │
│ Result │ 290.111µs │ 0.00% │ 8kB │
│ Total │ 1m11.205904842s │ │ 15GB │
│ ├╴Sent │ │ 100.00% │ 15GB │
│ ├╴Rcvd │ │ 0.00% │ 45kB │
│ ╰╴Flcd │ │ │ 231284 │
└──────────────┴─────────────────┴─────────┴────────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796) #w=853882864
Value.HashValue based WireAllocator
:
┌──────────────┬────────────────┬─────────┬────────┐
│ Op │ Time │ % │ Xfer │
├──────────────┼────────────────┼─────────┼────────┤
│ Compile │ 1.89192514s │ 2.70% │ │
│ Init │ 2.706353ms │ 0.00% │ 0B │
│ OT Init │ 11.731µs │ 0.00% │ 16kB │
│ Peer Inputs │ 45.549977ms │ 0.07% │ 57kB │
│ Stream │ 1m8.029901416s │ 97.23% │ 15GB │
│ ├╴InstrInit │ 2.933100244s │ 4.31% │ │
│ ├╴CircComp │ 30.339124ms │ 0.04% │ │
│ ├╴StreamInit │ 2.608974096s │ 3.84% │ │
│ ╰╴Garble │ 1m1.560371684s │ 90.49% │ │
│ Result │ 324.555µs │ 0.00% │ 8kB │
│ Total │ 1m9.970419172s │ │ 15GB │
│ ├╴Sent │ │ 100.00% │ 15GB │
│ ├╴Rcvd │ │ 0.00% │ 45kB │
│ ╰╴Flcd │ │ │ 231284 │
└──────────────┴────────────────┴─────────┴────────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796) #w=853882864
Optimized compiler/circuits/Wire
:
┌──────────────┬────────────────┬─────────┬────────┐
│ Op │ Time │ % │ Xfer │
├──────────────┼────────────────┼─────────┼────────┤
│ Compile │ 1.870993069s │ 2.71% │ │
│ Init │ 2.331431ms │ 0.00% │ 0B │
│ OT Init │ 10.949µs │ 0.00% │ 16kB │
│ Peer Inputs │ 44.089085ms │ 0.06% │ 57kB │
│ Stream │ 1m7.0813688s │ 97.22% │ 15GB │
│ ├╴InstrInit │ 2.421297578s │ 3.61% │ │
│ ├╴CircComp │ 17.09415ms │ 0.03% │ │
│ ├╴StreamInit │ 2.155089182s │ 3.21% │ │
│ ╰╴Garble │ 1m1.550598148s │ 91.76% │ │
│ Result │ 432.27µs │ 0.00% │ 8kB │
│ Total │ 1m8.999225604s │ │ 15GB │
│ ├╴Sent │ │ 100.00% │ 15GB │
│ ├╴Rcvd │ │ 0.00% │ 45kB │
│ ╰╴Flcd │ │ │ 231284 │
└──────────────┴────────────────┴─────────┴────────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796) #w=853882864
Optimized streamer to use circuit.Wire
instead of
compiler/circuits/Wire
in wire cache:
┌──────────────┬────────────────┬─────────┬────────┐
│ Op │ Time │ % │ Xfer │
├──────────────┼────────────────┼─────────┼────────┤
│ Compile │ 1.755362404s │ 2.64% │ │
│ Init │ 2.79287ms │ 0.00% │ 0B │
│ OT Init │ 13.525µs │ 0.00% │ 16kB │
│ Peer Inputs │ 45.376796ms │ 0.07% │ 57kB │
│ Stream │ 1m4.624303427s │ 97.28% │ 15GB │
│ ├╴InstrInit │ 1.166489974s │ 1.81% │ │
│ ├╴CircComp │ 18.17144ms │ 0.03% │ │
│ ├╴StreamInit │ 1.886360054s │ 2.92% │ │
│ ╰╴Garble │ 1m0.866348862s │ 94.18% │ │
│ Result │ 225.299µs │ 0.00% │ 8kB │
│ Total │ 1m6.428074321s │ │ 15GB │
│ ├╴Sent │ │ 100.00% │ 15GB │
│ ├╴Rcvd │ │ 0.00% │ 45kB │
│ ╰╴Flcd │ │ │ 231284 │
└──────────────┴────────────────┴─────────┴────────┘
Max permanent wires: 53913890, cached circuits: 25
#gates=830166294 (XOR=533177896 XNOR=28813441 AND=267575026 OR=496562 INV=103369 xor=561991337 !xor=268174957 levels=10548 width=1796) #w=853882864
66.59 real 69.15 user 6.69 sys
3568140288 maximum resident set size
4119990272 peak memory footprint
Theoretical minimum single-threaded garbling time:
XOR: 533177896 * 21.47 = 11447329427.119999 ns
XNOR: 28813441 * 19.98 = 575692551.180000 ns
AND: 267575026 * 155.10 = 41500886532.600000 ns
OR: 496562 * 143.20 = 71107678.399999 ns
INV: 103369 * 77.97 = 53603075870.229996 ns
=====================
53603075870.229996 ns
53.603076 s
The gate garbling speeds are measured with the
circuit/stream_garble_test.go
:
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
BenchmarkGarbleXOR-8 59785843 21.47 ns/op
BenchmarkGarbleXNOR-8 61427943 19.98 ns/op
BenchmarkGarbleAND-8 7628728 155.1 ns/op
BenchmarkGarbleOR-8 8398204 143.2 ns/op
BenchmarkGarbleINV-8 14924721 77.97 ns/op
Input | MODP | Gates | Non-XOR | Stream Gates | Stream !XOR | Stream |
---|---|---|---|---|---|---|
2 | 4 | 708 | 201 | 740 | 271 | 97.50ms |
4 | 8 | 5596 | 1571 | 5548 | 1719 | 250.25ms |
8 | 16 | 44796 | 12423 | 46252 | 13199 | 271.69ms |
16 | 32 | 374844 | 102255 | 364892 | 101535 | 295.81ms |
32 | 64 | 2986556 | 801887 | 2895932 | 788799 | 675.86ms |
64 | 128 | 23171068 | 6137023 | 22494524 | 6029311 | 2.2685s |
128 | 256 | 177580028 | 46495359 | 172945532 | 45732095 | 12.9422s |
256 | 512 | 1326461180 | 346797567 | 1m31.5s | ||
512 | 1024 | 10197960188 | 2641252351 | 11m28.7s |
Input Size | Total gates | Non-XOR gates |
---|---|---|
2 | 7 | 3 |
4 | 29 | 13 |
8 | 145 | 57 |
16 | 655 | 241 |
32 | 3347 | 1100 |
64 | 13546 | 4242 |
128 | 49249 | 14986 |
256 | 167977 | 50167 |
512 | 549965 | 162147 |
1024 | 1752826 | 512099 |
2048 | 5485700 | 1592234 |
4096 | 16954032 | 4897756 |
8192 | 51940803 | 14953708 |
Optimized circuits from pkg/math/:
Implementation | XOR gates | XOR % | !XOR gates | !XOR % |
---|---|---|---|---|
add64.circ | 313 | 63 | ||
sub64.circ | 313 | 126 | ||
mul64.circ | 9642 | 4033 | ||
div64.circ | 24817 | 5109 | ||
MPCL a+b | 251 | 80.2 | 63 | 100.0 |
MPCL a-b | 252 | 80.5 | 65 | 51.6 |
MPCL a*b | 8261 | 85.7 | 4007 | 99.4 |
MPCL R int a/b | 33273 | 134.1 | 10463 | 204.8 |
MPCL R uint a/b | 32133 | 129.5 | 10084 | 197.4 |
MPCL A int a/b | 25655 | 103.4 | 8574 | 167.8 |
MPCL A uint a/b | 24515 | 98.8 | 8194 | 160.4 |
MPCL L int a/b | 25209 | 101.6 | 8447 | 165.3 |
MPCL L uint a/b | 24069 | 97.0 | 8068 | 160.0 |