https://github.com/adjoint-io/bulletproofs 采用haskell语言编写,haskell为函数式编程语言,对于bulletproofs verify的inner product verify的递归验证契合度很高。
在Ubuntu16.04虚拟机内,1CPU,4G RAM
stack bench
bench 运行结果如下:
bulletproofs> benchmarks
Running 1 benchmarks...
Benchmark rangeproof-benchmarks: RUNNING...
benchmarking Rangeproof/Proving
time 1.294 s (1.270 s .. 1.304 s)
1.000 R² (1.000 R² .. 1.000 R²)
mean 1.277 s (1.263 s .. 1.285 s)
std dev 13.90 ms (1.715 ms .. 17.96 ms)
variance introduced by outliers: 19% (moderately inflated)
benchmarking Rangeproof/Verifying
time 582.4 ms (506.0 ms .. NaN s)
0.998 R² (0.992 R² .. 1.000 R²)
mean 595.1 ms (585.1 ms .. 612.7 ms)
std dev 17.09 ms (1.266 ms .. 21.99 ms)
variance introduced by outliers: 19% (moderately inflated)
Benchmark rangeproof-benchmarks: FINISH
stack setup
stack build --library-profiling
stack ghc -- -prof -fprof-auto -rtsopts bench/profiling/Rangeproof.hs -o Rangeproof
./Rangeproof +RTS -p
对应生成的Rangeproof.prof 内容如下:
Fri Jul 5 09:54 2019 Time and Allocation Profiling Report (Final)
Rangeproof +RTS -p -RTS
total time = 4.09 secs (4095 ticks @ 1000 us, 1 processor)
total alloc = 1,159,332,240 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
gmpInverse.r Crypto.Number.Compat Crypto/Number/Compat.hs:95:9-31 44.0 4.6
divmod Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:(173,1)-(175,26) 14.0 19.4
pointDouble.yr Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:83:9-47 9.1 15.4
pointDouble.xr Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:82:9-50 7.5 11.6
pointDouble Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:(79,1)-(93,20) 6.0 14.7
pointAdd.yr Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:52:13-46 5.2 10.4
pointAdd.xr Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:51:13-50 4.8 8.1
pointAdd Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:(42,1)-(60,20) 2.8 6.2
pointAddTwoMuls.go.q Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:133:13-59 1.4 3.5
pointAddTwoMuls.go Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:(131,5)-(138,33) 1.3 0.7
pointMul Crypto.PubKey.ECC.Prim Crypto/PubKey/ECC/Prim.hs:(105,1)-(111,58) 1.3 1.4
gmpInverse Crypto.Number.Compat Crypto/Number/Compat.hs:(92,1)-(95,31) 0.5 1.5
inverse Crypto.Number.ModArithmetic Crypto/Number/ModArithmetic.hs:(80,1)-(85,22) 0.3 1.5
individual inherited
COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc
MAIN MAIN 3336 0 0.0 0.0 100.0 100.0
CAF Bulletproofs.Curve 6671 0 0.0 0.0 9.0 8.9
_p Bulletproofs.Curve Bulletproofs/Curve.hs:(92,1)-(96,49) 6973 1 0.0 0.0 0.0 0.0
_p.cp Bulletproofs.Curve Bulletproofs/Curve.hs:(94,5)-(96,49) 6975 1 0.0 0.0 0.0 0.0
ecc_p Crypto.PubKey.ECC.Types Crypto/PubKey/ECC/Types.hs:77:1-26 6974 1 0.0 0.0 0.0 0.0
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。