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

Optimise merge registers for migrations #5522

Merged
merged 5 commits into from
Mar 25, 2024

Conversation

janezpodhostnik
Copy link
Contributor

@janezpodhostnik janezpodhostnik commented Mar 7, 2024

I have changed the snapshot so that it uses a map of key to array index. Because of that when merging in changes we don't need to go through all entries of the array.

This doesn't seem to have an impact on snapshot creation, or on the case where a large portion of the snapshot has been changed.

But for the case where a small portion of a large snapshot is changed, this is a ~44% improvement

Benchmarks

Before

Benchmark_Merge/create_1000
Benchmark_Merge/create_1000-12         	      20	    233152 ns/op
Benchmark_Merge/create_100000
Benchmark_Merge/create_100000-12       	      20	  25301158 ns/op
Benchmark_Merge/create_10000000
Benchmark_Merge/create_10000000-12     	      20	4743582931 ns/op
Benchmark_Merge/merge_1000_10
Benchmark_Merge/merge_1000_10-12       	      20	     96302 ns/op
Benchmark_Merge/merge_1000_100
Benchmark_Merge/merge_1000_100-12      	      20	     79810 ns/op
Benchmark_Merge/merge_1000_1000
Benchmark_Merge/merge_1000_1000-12     	      20	    127331 ns/op
Benchmark_Merge/merge_100000_10
Benchmark_Merge/merge_100000_10-12     	      20	   6931900 ns/op
Benchmark_Merge/merge_100000_1000
Benchmark_Merge/merge_100000_1000-12   	      20	   7132483 ns/op
Benchmark_Merge/merge_100000_100000
Benchmark_Merge/merge_100000_100000-12 	      20	  13534448 ns/op
Benchmark_Merge/merge_10000000_10
Benchmark_Merge/merge_10000000_10-12   	      20	1326502848 ns/op
Benchmark_Merge/merge_10000000_10000
Benchmark_Merge/merge_10000000_10000-12         	      20	1263474750 ns/op
Benchmark_Merge/merge_10000000_10000000
Benchmark_Merge/merge_10000000_10000000-12      	      20	3662666250 ns/op

After

Benchmark_Merge/create_1000
Benchmark_Merge/create_1000-12         	      20	    253258 ns/op
Benchmark_Merge/create_100000
Benchmark_Merge/create_100000-12       	      20	  30626292 ns/op
Benchmark_Merge/create_10000000
Benchmark_Merge/create_10000000-12     	      20	4893254794 ns/op
Benchmark_Merge/merge_1000_10
Benchmark_Merge/merge_1000_10-12       	      20	    125283 ns/op
Benchmark_Merge/merge_1000_100
Benchmark_Merge/merge_1000_100-12      	      20	     66300 ns/op
Benchmark_Merge/merge_1000_1000
Benchmark_Merge/merge_1000_1000-12     	      20	    120348 ns/op
Benchmark_Merge/merge_100000_10
Benchmark_Merge/merge_100000_10-12     	      20	   5339110 ns/op
Benchmark_Merge/merge_100000_1000
Benchmark_Merge/merge_100000_1000-12   	      20	   5314683 ns/op
Benchmark_Merge/merge_100000_100000
Benchmark_Merge/merge_100000_100000-12 	      20	  13250754 ns/op
Benchmark_Merge/merge_10000000_10
Benchmark_Merge/merge_10000000_10-12   	      20	 559134696 ns/op
Benchmark_Merge/merge_10000000_10000
Benchmark_Merge/merge_10000000_10000-12         	      20	 536417231 ns/op
Benchmark_Merge/merge_10000000_10000000
Benchmark_Merge/merge_10000000_10000000-12      	      20	2795973331 ns/op

Copy link
Member

@fxamacker fxamacker left a comment

Choose a reason for hiding this comment

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

Thanks for optimizing! I agree that this can speedup large snapshots having only a small portion changed.

Given this optimization has tradeoffs (uses more memory), can you include memory usage info in your benchmarks (B/op and allocs/op columns) and also add benchmark(s) for 100+ million payloads since largest account reached ~170 million payloads last summer?

I'm concerned Atree migration may have some performance regression for large accounts due to increased memory use. I left some comments about this.

nit: payload_shnapshot_test.go file probably needs to be renamed.

cmd/util/ledger/util/payload_shnapshot_test.go Outdated Show resolved Hide resolved
cmd/util/ledger/util/payload_shnapshot_test.go Outdated Show resolved Hide resolved
cmd/util/ledger/util/payload_shnapshot_test.go Outdated Show resolved Hide resolved
cmd/util/ledger/util/payload_shnapshot_test.go Outdated Show resolved Hide resolved
cmd/util/ledger/util/payload_shnapshot_test.go Outdated Show resolved Hide resolved
Base automatically changed from bastian/improve-migration-2 to feature/stable-cadence March 11, 2024 23:58
@janezpodhostnik
Copy link
Contributor Author

@fxamacker I got some surpising results from the benchmarks

goos: darwin
goarch: arm64
pkg: github.com/onflow/flow-go/cmd/util/ledger/util
Benchmark_PayloadSnapshot
Benchmark_PayloadSnapshot/create_1000
Benchmark_PayloadSnapshot/create_1000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_1000/MapBasedPayloadSnapshot-12         	    6338	    191957 ns/op	  274523 B/op	    5995 allocs/op
Benchmark_PayloadSnapshot/create_1000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_1000/PayloadSnapshot-12                 	    6096	    191220 ns/op	  266307 B/op	    5994 allocs/op
Benchmark_PayloadSnapshot/create_100000
Benchmark_PayloadSnapshot/create_100000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_100000/MapBasedPayloadSnapshot-12       	      58	  19676024 ns/op	24031418 B/op	  601641 allocs/op
Benchmark_PayloadSnapshot/create_100000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_100000/PayloadSnapshot-12               	      54	  19810440 ns/op	23230660 B/op	  601646 allocs/op
Benchmark_PayloadSnapshot/create_10000000
Benchmark_PayloadSnapshot/create_10000000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_10000000/MapBasedPayloadSnapshot-12     	       1	3377343875 ns/op	2508686488 B/op	59999997 allocs/op
Benchmark_PayloadSnapshot/create_10000000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_10000000/PayloadSnapshot-12             	       1	3325415833 ns/op	2428683392 B/op	59999996 allocs/op
Benchmark_PayloadSnapshot/merge_1000
Benchmark_PayloadSnapshot/merge_1000/changes_1000
Benchmark_PayloadSnapshot/merge_1000/changes_1000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000/MapBasedPayloadSnapshot-12         	  287155	      4255 ns/op	   13160 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000/PayloadSnapshot-12                 	   68947	     17578 ns/op	   21168 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000#01
Benchmark_PayloadSnapshot/merge_1000/changes_1000#01/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000#01/MapBasedPayloadSnapshot-12      	   90618	     13487 ns/op	   20280 B/op	     135 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000#01/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000#01/PayloadSnapshot-12              	   45922	     26625 ns/op	   26656 B/op	     133 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000#02
Benchmark_PayloadSnapshot/merge_1000/changes_1000#02/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000#02/MapBasedPayloadSnapshot-12      	   14796	     80913 ns/op	   81064 B/op	    1077 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000#02/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000#02/PayloadSnapshot-12              	   14058	     85434 ns/op	   71568 B/op	    1075 allocs/op
Benchmark_PayloadSnapshot/merge_100000
Benchmark_PayloadSnapshot/merge_100000/changes_100000
Benchmark_PayloadSnapshot/merge_100000/changes_100000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000/MapBasedPayloadSnapshot-12     	   10000	    125977 ns/op	 1008488 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000/PayloadSnapshot-12             	     729	   1808184 ns/op	 1811120 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000#01
Benchmark_PayloadSnapshot/merge_100000/changes_100000#01/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000#01/MapBasedPayloadSnapshot-12  	    4810	    225082 ns/op	 1088072 B/op	    1339 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000#01/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000#01/PayloadSnapshot-12          	     724	   1669820 ns/op	 1874480 B/op	    1337 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000#02
Benchmark_PayloadSnapshot/merge_100000/changes_100000#02/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000#02/MapBasedPayloadSnapshot-12  	     148	   8174259 ns/op	 7737897 B/op	  107287 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000#02/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000#02/PayloadSnapshot-12          	     100	  10168800 ns/op	 8221200 B/op	  107286 allocs/op
Benchmark_PayloadSnapshot/merge_10000000
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/MapBasedPayloadSnapshot-12 	      37	  45845741 ns/op	100008808 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/PayloadSnapshot-12         	       2	 531950084 ns/op	180011696 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#01
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#01/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#01/MapBasedPayloadSnapshot-12         	     100	  44647159 ns/op	100811753 B/op	   13337 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#01/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#01/PayloadSnapshot-12                 	       2	 624171354 ns/op	180650960 B/op	   13335 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#02
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#02/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#02/MapBasedPayloadSnapshot-12         	       1	2533207125 ns/op	771151704 B/op	10728241 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#02/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000#02/PayloadSnapshot-12                 	       1	3236515542 ns/op	819984192 B/op	10728240 allocs/op
PASS

They show that the reverse map based approach is equal to the original approach regarding allocations.

@fxamacker
Copy link
Member

@fxamacker I got some surpising results from the benchmarks

@janezpodhostnik Amazing! You mentioned a "~44% improvement" but these results from your benchmarks look awesome! 🚀 🎉

/merge_10000000/changes_10000000/MapBasedPayloadSnapshot-12     37     45845741 ns/op    100008808 B/op    19 allocs/op
/merge_10000000/changes_10000000/PayloadSnapshot-12                         2    531950084 ns/op    180011696 B/op    17 allocs/op

I'll take a closer look after wrapping up some urgent items (I'm out next week). Very curious to see maxRSS and total duration of migration using mainnet24 snapshot as input when run on gcp (with enough RAM).

@janezpodhostnik
Copy link
Contributor Author

There was an error in the benchmark naming, so here are the results again:

goos: darwin
goarch: arm64
pkg: github.com/onflow/flow-go/cmd/util/ledger/util
Benchmark_PayloadSnapshot
Benchmark_PayloadSnapshot/create_1000
Benchmark_PayloadSnapshot/create_1000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_1000/MapBasedPayloadSnapshot-12         	    6345	    189806 ns/op	  274522 B/op	    5995 allocs/op
Benchmark_PayloadSnapshot/create_1000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_1000/PayloadSnapshot-12                 	    6342	    188993 ns/op	  266306 B/op	    5994 allocs/op
Benchmark_PayloadSnapshot/create_100000
Benchmark_PayloadSnapshot/create_100000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_100000/MapBasedPayloadSnapshot-12       	      60	  19287565 ns/op	24035608 B/op	  601653 allocs/op
Benchmark_PayloadSnapshot/create_100000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_100000/PayloadSnapshot-12               	      63	  19271337 ns/op	23229734 B/op	  601643 allocs/op
Benchmark_PayloadSnapshot/create_10000000
Benchmark_PayloadSnapshot/create_10000000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/create_10000000/MapBasedPayloadSnapshot-12     	       1	3756713333 ns/op	2508686488 B/op	59999997 allocs/op
Benchmark_PayloadSnapshot/create_10000000/PayloadSnapshot
Benchmark_PayloadSnapshot/create_10000000/PayloadSnapshot-12             	       1	3586450959 ns/op	2428683392 B/op	59999996 allocs/op
Benchmark_PayloadSnapshot/merge_1000
Benchmark_PayloadSnapshot/merge_1000/changes_10
Benchmark_PayloadSnapshot/merge_1000/changes_10/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_10/MapBasedPayloadSnapshot-12         	  277328	      4059 ns/op	   13160 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_10/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_10/PayloadSnapshot-12                 	   69555	     17034 ns/op	   21168 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_100
Benchmark_PayloadSnapshot/merge_1000/changes_100/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_100/MapBasedPayloadSnapshot-12        	   92430	     13262 ns/op	   20424 B/op	     137 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_100/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_100/PayloadSnapshot-12                	   45949	     26313 ns/op	   26800 B/op	     135 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000
Benchmark_PayloadSnapshot/merge_1000/changes_1000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000/MapBasedPayloadSnapshot-12       	   15498	     78274 ns/op	   79992 B/op	    1065 allocs/op
Benchmark_PayloadSnapshot/merge_1000/changes_1000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_1000/changes_1000/PayloadSnapshot-12               	   13675	     86213 ns/op	   71008 B/op	    1063 allocs/op
Benchmark_PayloadSnapshot/merge_100000
Benchmark_PayloadSnapshot/merge_100000/changes_10
Benchmark_PayloadSnapshot/merge_100000/changes_10/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_10/MapBasedPayloadSnapshot-12       	   10000	    129852 ns/op	 1008488 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_10/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_10/PayloadSnapshot-12               	     711	   1557916 ns/op	 1811120 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_1000
Benchmark_PayloadSnapshot/merge_100000/changes_1000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_1000/MapBasedPayloadSnapshot-12     	    5739	    211038 ns/op	 1087880 B/op	    1335 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_1000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_1000/PayloadSnapshot-12             	     720	   1962199 ns/op	 1874288 B/op	    1333 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000
Benchmark_PayloadSnapshot/merge_100000/changes_100000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000/MapBasedPayloadSnapshot-12   	     135	   8045177 ns/op	 7748296 B/op	  107503 allocs/op
Benchmark_PayloadSnapshot/merge_100000/changes_100000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_100000/changes_100000/PayloadSnapshot-12           	     100	  10226462 ns/op	 8231600 B/op	  107502 allocs/op
Benchmark_PayloadSnapshot/merge_10000000
Benchmark_PayloadSnapshot/merge_10000000/changes_10
Benchmark_PayloadSnapshot/merge_10000000/changes_10/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10/MapBasedPayloadSnapshot-12     	      50	  42728700 ns/op	100008808 B/op	      19 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10/PayloadSnapshot-12             	       2	 627278292 ns/op	180011696 B/op	      17 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000
Benchmark_PayloadSnapshot/merge_10000000/changes_10000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000/MapBasedPayloadSnapshot-12  	     100	  44014605 ns/op	100811464 B/op	   13331 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000/PayloadSnapshot-12          	       2	 582249084 ns/op	180650672 B/op	   13329 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/MapBasedPayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/MapBasedPayloadSnapshot-12         	       1	3392543333 ns/op	771181704 B/op	10728525 allocs/op
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/PayloadSnapshot
Benchmark_PayloadSnapshot/merge_10000000/changes_10000000/PayloadSnapshot-12                 	       1	3708955459 ns/op	819997808 B/op	10728524 allocs/op
PASS

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great work!

@janezpodhostnik
Copy link
Contributor Author

Before I merge this I want to see how do we feel about only having the MapBasedPayloadSnapshot instead of having 2 implementations, since it look like there are no allocation penalties.

Copy link
Member

@fxamacker fxamacker left a comment

Choose a reason for hiding this comment

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

@janezpodhostnik Nice! 👍 Thanks for updating PR!

Before I merge this I want to see how do we feel about only having the MapBasedPayloadSnapshot instead of having 2 implementations, since it look like there are no allocation penalties.

I'm in favor of it (based on your amazing benchmark results) 🚀 👍 It looks like this PR can speedup both atree migration and Cadence 1.0 migration with far less memory overhead than initially thought (for the payload counts benchmarked).

One remaining concern is that we should confirm our expectations by running a test migration of all payloads from all accounts using mainnet snapshot/checkpoint as input.

If you want, we can merge this PR and I can try migration on large gcp vm when I return.

@codecov-commenter
Copy link

codecov-commenter commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.38%. Comparing base (533df91) to head (639573e).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/stable-cadence    #5522      +/-   ##
==========================================================
+ Coverage                   57.35%   60.38%   +3.03%     
==========================================================
  Files                         885      703     -182     
  Lines                       88700    69686   -19014     
==========================================================
- Hits                        50870    42077    -8793     
+ Misses                      33917    24328    -9589     
+ Partials                     3913     3281     -632     
Flag Coverage Δ
unittests 60.38% <ø> (+3.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -69,38 +68,6 @@ func (a *AccountsAtreeLedger) AllocateStorageIndex(owner []byte) (atree.StorageI
return v, nil
}

type PayloadSnapshot struct {
Copy link
Member

Choose a reason for hiding this comment

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

👌

@janezpodhostnik janezpodhostnik merged commit a21d52b into feature/stable-cadence Mar 25, 2024
55 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/optimise-merge branch March 25, 2024 17:05
@fxamacker
Copy link
Member

@janezpodhostnik @turbolent

One remaining concern is that we should confirm our expectations by running a test migration of all payloads from all accounts using mainnet snapshot/checkpoint as input.

⚠️ Unfortunately, using this optimization made atree migration ~20 minutes slower and use ~16 GB more RAM.

Before: MaxRSS is 2.07 TB, duration (including ~30m validation) is 4h23 
After:    MaxRSS is 2.09 TB, duration (including ~30m validation) is 4h43

I used Atree inlining + Cadence 0.42 using mainnet data (Jan 19, 2024 checkpoint) as input.

Test vm was large enough RAM=3.84 TB and I used nworkers=40 (for consistency with old benchmarks).

@janezpodhostnik
Copy link
Contributor Author

Thank you for the info.

I'm not quite sure why this is. The benchmarks looked promising...

I will prepare a PR to revert this.

@turbolent
Copy link
Member

Though it may have slight adverse effects on one migration (atree register inlining), maybe it's still helpful for others (e.g. updating contracts in the Cadence 1.0 migration)?

@fxamacker
Copy link
Member

I'm not quite sure why this is. The benchmarks looked promising...

I will prepare a PR to revert this.

@janezpodhostnik Maybe revert only for atree migration because I didn't test this optimization with Cadence 1.0 migration.

It is probably best to test with mainnet data as input for Cadence 1.0 migrations.

@fxamacker
Copy link
Member

Though it may have slight adverse effects on one migration (atree register inlining), maybe it's still helpful for others (e.g. updating contracts in the Cadence 1.0 migration)?

@turbolent I agree and I also think we should test with mainnet data as input for Cadence 1.0 migrations to determine impact of this optimization.

Both approaches have tradeoffs and we may benefit by using the most appropriate approach for each migration or account size.

@fxamacker
Copy link
Member

I'm going to try using account size at runtime to choose merge implementation.

I'll let you know how it goes!

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