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

[crypto/ed25519] Migrate to hdevalence/ed25519consensus #645

Merged
merged 13 commits into from
Dec 12, 2023

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Dec 8, 2023

Closes: #618

On large batches, curve25519-voi takes >=~59% less time than ed25519consensus to verify a batch. I created an issue to optimize this in the future.

goos: darwin
goarch: arm64
pkg: github.com/ava-labs/hypersdk/crypto/ed25519
BenchmarkStdLibVerifySingle-12          	   25488	     46636 ns/op	       0 B/op	       0 allocs/op
BenchmarkConsensusVerifySingle-12       	   25026	     49746 ns/op	       0 B/op	       0 allocs/op
BenchmarkOasisVerifySingle-12           	   38985	     30616 ns/op	       0 B/op	       0 allocs/op
BenchmarkOasisVerifyCache-12            	   43126	     26878 ns/op	      80 B/op	       2 allocs/op
BenchmarkConsensusBatchAddVerify/1-12   	   20367	     58998 ns/op	    5648 B/op	       9 allocs/op
BenchmarkConsensusBatchAddVerify/4-12   	    9326	    130121 ns/op	   17232 B/op	      17 allocs/op
BenchmarkConsensusBatchAddVerify/16-12  	    2929	    420688 ns/op	   69264 B/op	      43 allocs/op
BenchmarkConsensusBatchAddVerify/64-12  	     775	   1545830 ns/op	  253649 B/op	     141 allocs/op
BenchmarkConsensusBatchAddVerify/128-12 	     394	   3058001 ns/op	  496850 B/op	     270 allocs/op
BenchmarkConsensusBatchAddVerify/512-12 	      97	  12106657 ns/op	 1927155 B/op	    1040 allocs/op
BenchmarkConsensusBatchAddVerify/1024-12         	      50	  24355565 ns/op	 3812816 B/op	    2065 allocs/op
BenchmarkConsensusBatchAddVerify/4096-12         	      10	 100681646 ns/op	15424976 B/op	    8213 allocs/op
BenchmarkConsensusBatchAddVerify/16384-12        	       3	 448992083 ns/op	63077872 B/op	   32795 allocs/op
BenchmarkConsensusBatchVerify/1-12               	   20228	     59853 ns/op	    5552 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/4-12               	    9436	    130756 ns/op	   16704 B/op	      10 allocs/op
BenchmarkConsensusBatchVerify/16-12              	    2968	    412512 ns/op	   67008 B/op	      22 allocs/op
BenchmarkConsensusBatchVerify/64-12              	     782	   1531430 ns/op	  243969 B/op	      70 allocs/op
BenchmarkConsensusBatchVerify/128-12             	     392	   3096470 ns/op	  476929 B/op	     134 allocs/op
BenchmarkConsensusBatchVerify/512-12             	      99	  12071803 ns/op	 1845765 B/op	     518 allocs/op
BenchmarkConsensusBatchVerify/1024-12            	      50	  24384858 ns/op	 3657735 B/op	    1030 allocs/op
BenchmarkConsensusBatchVerify/4096-12            	      12	  99508948 ns/op	14532608 B/op	    4102 allocs/op
BenchmarkConsensusBatchVerify/16384-12           	       3	 449900194 ns/op	57982976 B/op	   16390 allocs/op
BenchmarkOasisBatchAddVerify/1-12                	   24224	     49812 ns/op	    6024 B/op	      14 allocs/op
BenchmarkOasisBatchAddVerify/4-12                	   10000	    106383 ns/op	   17584 B/op	      20 allocs/op
BenchmarkOasisBatchAddVerify/16-12               	    3644	    335543 ns/op	   63872 B/op	      44 allocs/op
BenchmarkOasisBatchAddVerify/64-12               	     964	   1243581 ns/op	  256528 B/op	     140 allocs/op
BenchmarkOasisBatchAddVerify/128-12              	     487	   2436196 ns/op	  280080 B/op	     198 allocs/op
BenchmarkOasisBatchAddVerify/512-12              	     153	   7782252 ns/op	  664597 B/op	     198 allocs/op
BenchmarkOasisBatchAddVerify/1024-12             	      85	  14240017 ns/op	 1133104 B/op	     198 allocs/op
BenchmarkOasisBatchAddVerify/4096-12             	      22	  51599555 ns/op	 3996180 B/op	     198 allocs/op
BenchmarkOasisBatchAddVerify/16384-12            	       5	 200911283 ns/op	15375331 B/op	     199 allocs/op
BenchmarkOasisBatchVerify/1-12                   	   28848	     41518 ns/op	    4072 B/op	      11 allocs/op
BenchmarkOasisBatchVerify/4-12                   	   15890	     75333 ns/op	    9776 B/op	      11 allocs/op
BenchmarkOasisBatchVerify/16-12                  	    5637	    213080 ns/op	   33024 B/op	      11 allocs/op
BenchmarkOasisBatchVerify/64-12                  	    1580	    755199 ns/op	  133008 B/op	      11 allocs/op
BenchmarkOasisBatchVerify/128-12                 	     784	   1526393 ns/op	   81360 B/op	       9 allocs/op
BenchmarkOasisBatchVerify/512-12                 	     241	   4693929 ns/op	  302033 B/op	       9 allocs/op
BenchmarkOasisBatchVerify/1024-12                	     147	   8049920 ns/op	  557520 B/op	       9 allocs/op
BenchmarkOasisBatchVerify/4096-12                	      42	  28325917 ns/op	 2118096 B/op	       9 allocs/op
BenchmarkOasisBatchVerify/16384-12               	      10	 109379188 ns/op	 8286672 B/op	       9 allocs/op
BenchmarkOasisBatchAddVerifyCache/1-12           	   26643	     44993 ns/op	    4600 B/op	      14 allocs/op
BenchmarkOasisBatchAddVerifyCache/4-12           	   13509	     90261 ns/op	   11888 B/op	      20 allocs/op
BenchmarkOasisBatchAddVerifyCache/16-12          	    4458	    264921 ns/op	   41088 B/op	      44 allocs/op
BenchmarkOasisBatchAddVerifyCache/64-12          	    1232	    965304 ns/op	  165393 B/op	     140 allocs/op
BenchmarkOasisBatchAddVerifyCache/128-12         	     619	   1941707 ns/op	  148944 B/op	     266 allocs/op
BenchmarkOasisBatchAddVerifyCache/512-12         	     189	   6365164 ns/op	  564178 B/op	    1034 allocs/op
BenchmarkOasisBatchAddVerifyCache/1024-12        	     100	  11362132 ns/op	 1073621 B/op	    2058 allocs/op
BenchmarkOasisBatchAddVerifyCache/4096-12        	      27	  41696002 ns/op	 4182483 B/op	    8202 allocs/op
BenchmarkOasisBatchAddVerifyCache/16384-12       	       7	 162148232 ns/op	16544208 B/op	   32778 allocs/op
BenchmarkOasisBatchVerifyCache/1-12              	   28605	     41697 ns/op	    4072 B/op	      11 allocs/op
BenchmarkOasisBatchVerifyCache/4-12              	   15844	     75848 ns/op	    9776 B/op	      11 allocs/op
BenchmarkOasisBatchVerifyCache/16-12             	    5606	    213346 ns/op	   33024 B/op	      11 allocs/op
BenchmarkOasisBatchVerifyCache/64-12             	    1560	    756673 ns/op	  133008 B/op	      11 allocs/op
BenchmarkOasisBatchVerifyCache/128-12            	     784	   1529506 ns/op	   81360 B/op	       9 allocs/op
BenchmarkOasisBatchVerifyCache/512-12            	     254	   4698587 ns/op	  302032 B/op	       9 allocs/op
BenchmarkOasisBatchVerifyCache/1024-12           	     146	   8100722 ns/op	  557523 B/op	       9 allocs/op
BenchmarkOasisBatchVerifyCache/4096-12           	      42	  28443873 ns/op	 2118100 B/op	       9 allocs/op
BenchmarkOasisBatchVerifyCache/16384-12          	      10	 109633833 ns/op	 8286681 B/op	       9 allocs/op

TODO

  • Add benchmark for just verify step (after all adds are done)

Future Work

@patrick-ogrady patrick-ogrady self-assigned this Dec 8, 2023
Copy link
Contributor

@richardpringle richardpringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

But I should not be the one approving this

hexfusion
hexfusion previously approved these changes Dec 12, 2023
@patrick-ogrady patrick-ogrady enabled auto-merge (squash) December 12, 2023 17:43
@patrick-ogrady patrick-ogrady merged commit e2d1b8c into main Dec 12, 2023
22 checks passed
@patrick-ogrady patrick-ogrady deleted the ed25519consensus branch December 12, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
3 participants