/ benchmarks / bench_summary_pasta.nim
bench_summary_pasta.nim
 1  # Constantine
 2  # Copyright (c) 2018-2019    Status Research & Development GmbH
 3  # Copyright (c) 2020-Present Mamy André-Ratsimbazafy
 4  # Licensed and distributed under either of
 5  #   * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
 6  #   * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
 7  # at your option. This file may not be copied, modified, or distributed except according to those terms.
 8  
 9  import
10    # Internals
11    ../constantine/math/config/curves,
12    ../constantine/math/arithmetic,
13    ../constantine/math/extension_fields,
14    # Helpers
15    ./bench_summary_template
16  
17  # ############################################################
18  #
19  #            Benchmark of Pallas and Vesta curves
20  #
21  # ############################################################
22  
23  
24  const Iters = 5000
25  const AvailableCurves = [
26    Pallas, Vesta
27  ]
28  
29  
30  proc main() =
31    separator()
32    staticFor i, 0, AvailableCurves.len:
33      const curve = AvailableCurves[i]
34  
35      mulBench(Fr[curve], Iters)
36      sqrBench(Fr[curve], Iters)
37      separator()
38      mulBench(Fp[curve], Iters)
39      sqrBench(Fp[curve], Iters)
40      invBench(Fp[curve], Iters)
41      sqrtBench(Fp[curve], Iters)
42      separator()
43      addBench(ECP_ShortW_Prj[Fp[curve], G1], Iters)
44      mixedAddBench(ECP_ShortW_Prj[Fp[curve], G1], Iters)
45      doublingBench(ECP_ShortW_Prj[Fp[curve], G1], Iters)
46      separator()
47      addBench(ECP_ShortW_Jac[Fp[curve], G1], Iters)
48      mixedAddBench(ECP_ShortW_Jac[Fp[curve], G1], Iters)
49      doublingBench(ECP_ShortW_Jac[Fp[curve], G1], Iters)
50      separator()
51      scalarMulBench(ECP_ShortW_Prj[Fp[curve], G1], Iters)
52      scalarMulBench(ECP_ShortW_Jac[Fp[curve], G1], Iters)
53      separator()
54  
55  main()
56  notes()