Skip to content

Conversation

@mcrakhman
Copy link
Contributor

Overview

This PR aims at improving performance of CreateCommitments by parallelizing splitting of blobs, computing subtree roots in parallel and reusing buffers and NMT instances.

This gives us 1.5x to 4x performance increase in different situations (for 16x8 mb we get 4x on my Mac).

Benchmarks

BenchmarkCommitmentsComparison
BenchmarkCommitmentsComparison/1x1MB_Sequential
BenchmarkCommitmentsComparison/1x1MB_Sequential-14         	     966	   1223664 ns/op	 3582022 B/op	   17807 allocs/op
BenchmarkCommitmentsComparison/1x1MB_Parallel
BenchmarkCommitmentsComparison/1x1MB_Parallel-14           	    1588	    750563 ns/op	 2543064 B/op	    8931 allocs/op
BenchmarkCommitmentsComparison/10x100KB_Sequential
BenchmarkCommitmentsComparison/10x100KB_Sequential-14      	     594	   2060199 ns/op	 7320085 B/op	   23700 allocs/op
BenchmarkCommitmentsComparison/10x100KB_Parallel
BenchmarkCommitmentsComparison/10x100KB_Parallel-14        	     952	   1253340 ns/op	 2079143 B/op	   11557 allocs/op
BenchmarkCommitmentsComparison/100x10KB_Sequential
BenchmarkCommitmentsComparison/100x10KB_Sequential-14      	     303	   3852859 ns/op	19372949 B/op	   43500 allocs/op
BenchmarkCommitmentsComparison/100x10KB_Parallel
BenchmarkCommitmentsComparison/100x10KB_Parallel-14        	     342	   3546529 ns/op	 3369243 B/op	   26542 allocs/op
BenchmarkCommitmentsComparison/4x1MB_Sequential
BenchmarkCommitmentsComparison/4x1MB_Sequential-14         	     254	   4489126 ns/op	14327977 B/op	   71228 allocs/op
BenchmarkCommitmentsComparison/4x1MB_Parallel
BenchmarkCommitmentsComparison/4x1MB_Parallel-14           	     858	   1585797 ns/op	 7194928 B/op	   29419 allocs/op
BenchmarkCommitmentsComparison/16x256KB_Sequential
BenchmarkCommitmentsComparison/16x256KB_Sequential-14      	     247	   4841577 ns/op	17141303 B/op	   75968 allocs/op
BenchmarkCommitmentsComparison/16x256KB_Parallel
BenchmarkCommitmentsComparison/16x256KB_Parallel-14        	     708	   1696259 ns/op	 6672781 B/op	   31611 allocs/op
BenchmarkCommitmentsComparison/64x64KB_Sequential
BenchmarkCommitmentsComparison/64x64KB_Sequential-14       	     204	   5811526 ns/op	28969047 B/op	   94784 allocs/op
BenchmarkCommitmentsComparison/64x64KB_Parallel
BenchmarkCommitmentsComparison/64x64KB_Parallel-14         	     325	   3726106 ns/op	 7729641 B/op	   45359 allocs/op
BenchmarkCommitmentsComparison/16x8MB_Sequential
BenchmarkCommitmentsComparison/16x8MB_Sequential-14        	       8	 129458542 ns/op	456152598 B/op	 2243232 allocs/op
BenchmarkCommitmentsComparison/16x8MB_Parallel
BenchmarkCommitmentsComparison/16x8MB_Parallel-14          	      45	  24551298 ns/op	206414833 B/op	  852863 allocs/op
PASS

rootulp
rootulp previously approved these changes Sep 29, 2025
@mcrakhman mcrakhman marked this pull request as ready for review September 29, 2025 20:20
@mcrakhman mcrakhman requested review from a team as code owners September 29, 2025 20:20
@mcrakhman mcrakhman requested review from Wondertan, ninabarbakadze, tzdybal and vgonkivs and removed request for a team September 29, 2025 20:20
rach-id
rach-id previously approved these changes Oct 1, 2025
@mcrakhman mcrakhman dismissed stale reviews from rach-id and rootulp via 266c680 October 1, 2025 16:01
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

lgtm, lfg

@mcrakhman mcrakhman merged commit ce051a4 into main Oct 1, 2025
10 checks passed
@mcrakhman mcrakhman deleted the mcrakhman/commitment-reuse-buffer branch October 1, 2025 16:18
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.

4 participants