/ speed / README.org
README.org
 1  #+TITLE: Speed comparison
 2  #+OPTIONS: author:nil toc:nil
 3  
 4  * Comparison prerequisits
 5  
 6  oqsprovider (found in https://github.com/open-quantum-safe/oqs-provider.git)
 7  and the oqs plugin found here were built against the same liboqs
 8  library, installed in =$HOME/.local=.
 9  
10  ** liboqs build:
11  
12  #+begin_src
13    $ cd $HOME/src/liboqs
14    $ cmake -S . -B _build -DCMAKE_INSTALL_PREFIX=$HOME/.local
15    $ cmake --build _build
16    $ cmakd --install _build
17  #+end_src
18  
19  The installation step is necessary, 'cause building against its build
20  directory doesn't work quite right.
21  
22  ** oqsprovider build and measurement:
23  
24  #+begin_src
25    $ cd $HOME/src/osq-provider
26    $ git show --pretty=oneline --no-patch --no-decorate HEAD
27    ff34addef3e418d6e4c8ee50b537722c9a7f25e3 Update OIDs and code points for signature MAYO round 2 (#654)
28    $ cmake -S . -B _build -DCMAKE_PREFIX_PATH=$HOME/.local
29    $ cmake --build _build
30  #+end_src
31  
32  #+begin_src
33    $ openssl speed -provider-path _build/lib -provider oqsprovider -provider default mlkem512 mlkem768 mlkem1024
34    Doing mlkem512 keygen ops for 10s: 1044906 mlkem512 KEM keygen ops in 9.86s
35    Doing mlkem512 encaps ops for 10s: 1131325 mlkem512 KEM encaps ops in 9.88s
36    Doing mlkem512 decaps ops for 10s: 987456 mlkem512 KEM decaps ops in 9.98s
37    Doing mlkem768 keygen ops for 10s: 674434 mlkem768 KEM keygen ops in 9.88s
38    Doing mlkem768 encaps ops for 10s: 704105 mlkem768 KEM encaps ops in 9.88s
39    Doing mlkem768 decaps ops for 10s: 616757 mlkem768 KEM decaps ops in 9.99s
40    Doing mlkem1024 keygen ops for 10s: 483089 mlkem1024 KEM keygen ops in 9.95s
41    Doing mlkem1024 encaps ops for 10s: 512344 mlkem1024 KEM encaps ops in 9.95s
42    Doing mlkem1024 decaps ops for 10s: 446131 mlkem1024 KEM decaps ops in 10.00s
43    version: 3.4.1
44    built on: Tue Feb 11 20:30:30 2025 UTC
45    options: bn(64,64)
46    compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -fzero-call-used-regs=used-gpr -Wa,--noexecstack -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/openssl-3.4.1=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DZLIB -DZSTD -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
47    CPUINFO: OPENSSL_ia32cap=0x7ffaf3bfffebffff:0x40000000029c67af
48                                   keygen    encaps    decaps keygens/s  encaps/s  decaps/s
49                       mlkem512 0.000009s 0.000009s 0.000010s  105974.2  114506.6   98943.5
50                       mlkem768 0.000015s 0.000014s 0.000016s   68262.6   71265.7   61737.4
51                      mlkem1024 0.000021s 0.000019s 0.000022s   48551.7   51491.9   44613.1
52  
53  #+end_src
54  
55  ** oqs plugin build and measurement:
56  
57  #+begin_src
58    $ cd $HOME/src/oqs
59    $ cmake -S . -B _build -DCMAKE_PREFIX_PATH=$HOME/.local
60    $ cmake --build _build
61    $ ./_build/wrap.sh ../Le-Sec/test-tools/lesec-make-speed-script -s speed -a \
62      | ./_build/wrap.sh bash -s | tee /dev/tty | sed -E -e 's|^Doing [0-9]+ bits|Doing|' \
63      | ../Le-Sec/test-tools/lesec-analyse-speed-result
64  Doing ML-KEM-512 genkey ops for 10s: 1298900 ops in 10.00s
65  Doing ML-KEM-512 encap ops for 10s: 1149258 ops in 10.00s
66  Doing 6144 bits ML-KEM-512 decap ops for 10s: 993998 ops in 10.00s
67  Doing ML-KEM-768 genkey ops for 10s: 745357 ops in 10.00s
68  Doing ML-KEM-768 encap ops for 10s: 756396 ops in 10.00s
69  Doing 8704 bits ML-KEM-768 decap ops for 10s: 654224 ops in 10.00s
70  Doing ML-KEM-1024 genkey ops for 10s: 568315 ops in 10.00s
71  Doing ML-KEM-1024 encap ops for 10s: 538599 ops in 10.00s
72  Doing 12544 bits ML-KEM-1024 decap ops for 10s: 461479 ops in 10.00s
73  
74              s/genkey   s/encap   s/decap  genkey/s   encap/s  decap/s
75  ML-KEM-512  0.000008  0.000009  0.000010  129890.0  114925.8  99399.8
76  
77              s/genkey   s/encap   s/decap  genkey/s  encap/s  decap/s
78  ML-KEM-768  0.000013  0.000013  0.000015   74535.7  75639.6  65422.4
79  
80               s/genkey   s/encap   s/decap  genkey/s  encap/s  decap/s
81  ML-KEM-1024  0.000018  0.000019  0.000022   56831.5  53859.9  46147.9
82  #+end_src
83  
84  The sed snippet is to reformat the output slightly, 'cause
85  =lesec-speed= outputs the number of input bits, which isn't relevant
86  for algorithms like ML-KEM, where each algorithm variant has one
87  input size only.