Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks for all OPRF suites (including a new Ristretto255 suite) #350

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

chris-wood
Copy link
Contributor

We were previously only testing P-256, but it's probably useful to have benchmarks for all suites (to compare and contrast for applications like Privacy Pass).

Benchmarks from my machine are below.

✗ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/cloudflare/circl/oprf
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkAPI/OPRF_OPRF(ristretto255,_SHA-512)/Client/Request-12         	    8329	    134348 ns/op
BenchmarkAPI/OPRF_OPRF(ristretto255,_SHA-512)/Server/Evaluate-12        	   10000	    117887 ns/op
BenchmarkAPI/OPRF_OPRF(ristretto255,_SHA-512)/Client/Finalize-12        	    6694	    185566 ns/op
BenchmarkAPI/OPRF_OPRF(ristretto255,_SHA-512)/Server/VerifyFinalize-12  	    8535	    137740 ns/op
BenchmarkAPI/OPRF_OPRF(ristretto255,_SHA-512)/Server/FullEvaluate-12    	    8502	    137558 ns/op
BenchmarkAPI/VOPRFOPRF(ristretto255,_SHA-512)/Client/Request-12         	    9141	    132059 ns/op
BenchmarkAPI/VOPRFOPRF(ristretto255,_SHA-512)/Server/Evaluate-12        	    2575	    448148 ns/op
BenchmarkAPI/VOPRFOPRF(ristretto255,_SHA-512)/Client/Finalize-12        	    1663	    690075 ns/op
BenchmarkAPI/VOPRFOPRF(ristretto255,_SHA-512)/Server/VerifyFinalize-12  	    8941	    138982 ns/op
BenchmarkAPI/VOPRFOPRF(ristretto255,_SHA-512)/Server/FullEvaluate-12    	    8721	    138919 ns/op
BenchmarkAPI/POPRFOPRF(ristretto255,_SHA-512)/Client/Request-12         	    9058	    132935 ns/op
BenchmarkAPI/POPRFOPRF(ristretto255,_SHA-512)/Server/Evaluate-12        	    2313	    499251 ns/op
BenchmarkAPI/POPRFOPRF(ristretto255,_SHA-512)/Client/Finalize-12        	    1651	    709824 ns/op
BenchmarkAPI/POPRFOPRF(ristretto255,_SHA-512)/Server/VerifyFinalize-12  	    5809	    204057 ns/op
BenchmarkAPI/POPRFOPRF(ristretto255,_SHA-512)/Server/FullEvaluate-12    	    5820	    201851 ns/op
BenchmarkAPI/OPRF_OPRF(P-256,_SHA-256)/Client/Request-12                	    3994	    302609 ns/op
BenchmarkAPI/OPRF_OPRF(P-256,_SHA-256)/Server/Evaluate-12               	   10000	    104789 ns/op
BenchmarkAPI/OPRF_OPRF(P-256,_SHA-256)/Client/Finalize-12               	   10000	    114940 ns/op
BenchmarkAPI/OPRF_OPRF(P-256,_SHA-256)/Server/VerifyFinalize-12         	    4144	    293959 ns/op
BenchmarkAPI/OPRF_OPRF(P-256,_SHA-256)/Server/FullEvaluate-12           	    4052	    293190 ns/op
BenchmarkAPI/VOPRFOPRF(P-256,_SHA-256)/Client/Request-12                	    4026	    314748 ns/op
BenchmarkAPI/VOPRFOPRF(P-256,_SHA-256)/Server/Evaluate-12               	    2956	    410958 ns/op
BenchmarkAPI/VOPRFOPRF(P-256,_SHA-256)/Client/Finalize-12               	    2037	    589849 ns/op
BenchmarkAPI/VOPRFOPRF(P-256,_SHA-256)/Server/VerifyFinalize-12         	    4155	    291355 ns/op
BenchmarkAPI/VOPRFOPRF(P-256,_SHA-256)/Server/FullEvaluate-12           	    4185	    291373 ns/op
BenchmarkAPI/POPRFOPRF(P-256,_SHA-256)/Client/Request-12                	    4021	    300035 ns/op
BenchmarkAPI/POPRFOPRF(P-256,_SHA-256)/Server/Evaluate-12               	    2788	    423762 ns/op
BenchmarkAPI/POPRFOPRF(P-256,_SHA-256)/Client/Finalize-12               	    1928	    615774 ns/op
BenchmarkAPI/POPRFOPRF(P-256,_SHA-256)/Server/VerifyFinalize-12         	    3862	    310359 ns/op
BenchmarkAPI/POPRFOPRF(P-256,_SHA-256)/Server/FullEvaluate-12           	    3822	    310828 ns/op
BenchmarkAPI/OPRF_OPRF(P-384,_SHA-384)/Client/Request-12                	    1178	   1006420 ns/op
BenchmarkAPI/OPRF_OPRF(P-384,_SHA-384)/Server/Evaluate-12               	    1963	    596119 ns/op
BenchmarkAPI/OPRF_OPRF(P-384,_SHA-384)/Client/Finalize-12               	    1882	    618329 ns/op
BenchmarkAPI/OPRF_OPRF(P-384,_SHA-384)/Server/VerifyFinalize-12         	    1179	   1010536 ns/op
BenchmarkAPI/OPRF_OPRF(P-384,_SHA-384)/Server/FullEvaluate-12           	    1171	   1038197 ns/op
BenchmarkAPI/VOPRFOPRF(P-384,_SHA-384)/Client/Request-12                	    1166	   1013154 ns/op
BenchmarkAPI/VOPRFOPRF(P-384,_SHA-384)/Server/Evaluate-12               	     500	   2712349 ns/op
BenchmarkAPI/VOPRFOPRF(P-384,_SHA-384)/Client/Finalize-12               	     301	   3485267 ns/op
BenchmarkAPI/VOPRFOPRF(P-384,_SHA-384)/Server/VerifyFinalize-12         	    1191	   1007107 ns/op
BenchmarkAPI/VOPRFOPRF(P-384,_SHA-384)/Server/FullEvaluate-12           	    1191	   1076705 ns/op
BenchmarkAPI/POPRFOPRF(P-384,_SHA-384)/Client/Request-12                	    1171	   1084027 ns/op
BenchmarkAPI/POPRFOPRF(P-384,_SHA-384)/Server/Evaluate-12               	     393	   2896576 ns/op
BenchmarkAPI/POPRFOPRF(P-384,_SHA-384)/Client/Finalize-12               	     253	   4010709 ns/op
BenchmarkAPI/POPRFOPRF(P-384,_SHA-384)/Server/VerifyFinalize-12         	    1070	   1028873 ns/op
BenchmarkAPI/POPRFOPRF(P-384,_SHA-384)/Server/FullEvaluate-12           	    1172	   1049010 ns/op
BenchmarkAPI/OPRF_OPRF(P-521,_SHA-512)/Client/Request-12                	     303	   4258508 ns/op
BenchmarkAPI/OPRF_OPRF(P-521,_SHA-512)/Server/Evaluate-12               	     378	   2999543 ns/op
BenchmarkAPI/OPRF_OPRF(P-521,_SHA-512)/Client/Finalize-12               	     386	   3152643 ns/op
BenchmarkAPI/OPRF_OPRF(P-521,_SHA-512)/Server/VerifyFinalize-12         	     295	   4283408 ns/op
BenchmarkAPI/OPRF_OPRF(P-521,_SHA-512)/Server/FullEvaluate-12           	     321	   3645406 ns/op
BenchmarkAPI/VOPRFOPRF(P-521,_SHA-512)/Client/Request-12                	     319	   3712189 ns/op
BenchmarkAPI/VOPRFOPRF(P-521,_SHA-512)/Server/Evaluate-12               	     100	  10300027 ns/op
BenchmarkAPI/VOPRFOPRF(P-521,_SHA-512)/Client/Finalize-12               	      78	  14856760 ns/op
BenchmarkAPI/VOPRFOPRF(P-521,_SHA-512)/Server/VerifyFinalize-12         	     322	   3744080 ns/op
BenchmarkAPI/VOPRFOPRF(P-521,_SHA-512)/Server/FullEvaluate-12           	     319	   3698312 ns/op
BenchmarkAPI/POPRFOPRF(P-521,_SHA-512)/Client/Request-12                	     319	   3693820 ns/op
BenchmarkAPI/POPRFOPRF(P-521,_SHA-512)/Server/Evaluate-12               	      97	  11619638 ns/op
BenchmarkAPI/POPRFOPRF(P-521,_SHA-512)/Client/Finalize-12               	      76	  15998667 ns/op
BenchmarkAPI/POPRFOPRF(P-521,_SHA-512)/Server/VerifyFinalize-12         	     319	   3727345 ns/op
BenchmarkAPI/POPRFOPRF(P-521,_SHA-512)/Server/FullEvaluate-12           	     314	   3772882 ns/op

@chris-wood chris-wood requested a review from armfazh July 22, 2022 12:15
@armfazh
Copy link
Contributor

armfazh commented Jul 22, 2022

it's good, only one nit in formatting the name (see suggestions), and there is a conflict need to be resolved.

oprf/oprf_test.go Outdated Show resolved Hide resolved
oprf/oprf_test.go Outdated Show resolved Hide resolved
oprf/oprf_test.go Outdated Show resolved Hide resolved
@chris-wood
Copy link
Contributor Author

Thanks @armfazh -- applied the suggestions and fixed the conflict. This should be ready to go now.

@armfazh armfazh merged commit 750ca5e into main Jul 22, 2022
@armfazh armfazh deleted the caw/oprf-benchmarks branch July 22, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants