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] Preallocate batch size for verification #695

Merged
merged 2 commits into from
Jan 21, 2024

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Jan 21, 2024

Related: #645

hdevalence/ed25519consensus#16

Previous

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

PR (99% reduction in allocs)

BenchmarkConsensusBatchAddVerify/1-12   	   20077	     60035 ns/op	    5728 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/4-12   	    9250	    131768 ns/op	   17312 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/16-12  	    2857	    417964 ns/op	   69216 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/64-12  	     759	   1599658 ns/op	  252832 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/128-12 	     380	   3107973 ns/op	  494626 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/512-12 	      99	  12248031 ns/op	 1919529 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/1024-12         	      49	  24498628 ns/op	 3797029 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/4096-12         	      10	 101433183 ns/op	15065129 B/op	       8 allocs/op
BenchmarkConsensusBatchAddVerify/16384-12        	       3	 452705625 ns/op	60096544 B/op	       8 allocs/op
BenchmarkConsensusBatchVerify/1-12               	   19965	     60094 ns/op	    5552 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/4-12               	    8989	    131767 ns/op	   16608 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/16-12              	    2839	    418850 ns/op	   66528 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/64-12              	     763	   1565576 ns/op	  241953 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/128-12             	     388	   3068891 ns/op	  472865 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/512-12             	      98	  12609815 ns/op	 1829415 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/1024-12            	      46	  24334647 ns/op	 3624998 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/4096-12            	      12	  99872802 ns/op	14401584 B/op	       7 allocs/op
BenchmarkConsensusBatchVerify/16384-12           	       3	 450050639 ns/op	57458720 B/op	       7 allocs/op

@patrick-ogrady patrick-ogrady merged commit d27a71b into main Jan 21, 2024
22 checks passed
@patrick-ogrady patrick-ogrady deleted the preallocate-ed25519 branch January 21, 2024 15:46
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
Development

Successfully merging this pull request may close these issues.

1 participant