Commit d89ee3b
Issues/1310 shrink snapshot file (#1648)
### What
Add a compact format for `LedgerSnapshot` to prevent having to write
duplicate `LedgerKey` data to files.
On serialization, the `LedgerKey` is derived from the `LedgerEntry` to
keep the public interface the same.
### Why
Fixes #1310 .
Tested against a large snapshot (82mb). File was reduced to 53mb, or
~35% reduction.
Roundtrip to serialize the large snapshot and write it back takes 60s
with the old way, and 22s for the new way. A good half of this
optimization comes from using `BufReader`.
The memory footprint does increase by the size of the snapshot due to
conversions between the compact and ledgerSnapshot type, and up to 2x
the snapshot if we are reading a snapshot of the old format. I assume
this is due to how serde manages the deserialization retry logic for
enums.
### Known limitations
N/A
---------
Co-authored-by: Leigh <351529+leighmcculloch@users.noreply.github.com>1 parent 436a946 commit d89ee3b
File tree
155 files changed
+9493
-13090
lines changed- soroban-ledger-snapshot
- src
- test_data
- soroban-sdk
- src
- test_snapshots/tests
- address
- auth
- auth_10_one
- auth_15_one_repeat
- auth_17_no_consume_requirement
- auth_20_deep_one_address
- auth_30_deep_one_address_repeat
- auth_35_deep_one_address_repeat_grouped
- auth_40_multi_one_address
- contract_add_i32
- contract_assert
- contract_custom_account_impl
- contract_docs/fn_
- contract_duration
- contract_event
- contract_fn
- contract_invoke_arg_count
- contract_invoke
- contract_overlapping_type_fn_names
- contract_snapshot
- contract_store
- contract_timepoint
- contract_udt_enum_error
- contract_udt_enum
- contract_udt_option
- contract_udt_struct_tuple
- contract_udt_struct
- cost_estimate
- crypto_bls12_381
- env
- max_ttl
- muxed_address
- prng
- storage_testutils
- token_client
- soroban-token-sdk/test_snapshots/tests/events
- stellar-asset-spec/test_snapshots/tests/events
- tests
- account/test_snapshots/test
- add_i128/test_snapshots/test
- add_u128/test_snapshots/test
- add_u64/test_snapshots/test
- associated_type_contracttrait/test_snapshots
- test_with_wasm
- test
- associated_type/test_snapshots/test
- auth/test_snapshots
- test_a
- test_b
- bls/test_snapshots/test
- constructor/test_snapshots
- contracttrait_impl_full/test_snapshots/test
- contracttrait_impl_partial/test_snapshots/test
- contracttrait_trait/test_snapshots/test
- empty2/test_snapshots/test
- empty/test_snapshots/test
- errors/test_snapshots/test
- events_ref/test_snapshots/test
- events/test_snapshots/test
- generics/test_snapshots/test
- invoke_contract/test_snapshots/test
- logging/test_snapshots/test
- macros/test_snapshots/test
- modular/test_snapshots/test
- multiimpl/test_snapshots/test
- mutability/test_snapshots/test
- tuples/test_snapshots/test
- udt/test_snapshots/test
- workspace_contract/test_snapshots/test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
155 files changed
+9493
-13090
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
41 | 114 | | |
42 | | - | |
| 115 | + | |
43 | 116 | | |
44 | 117 | | |
45 | 118 | | |
| |||
65 | 138 | | |
66 | 139 | | |
67 | 140 | | |
68 | | - | |
| 141 | + | |
69 | 142 | | |
70 | 143 | | |
71 | 144 | | |
| |||
136 | 209 | | |
137 | 210 | | |
138 | 211 | | |
139 | | - | |
| 212 | + | |
140 | 213 | | |
141 | 214 | | |
142 | 215 | | |
143 | 216 | | |
144 | | - | |
| 217 | + | |
145 | 218 | | |
146 | | - | |
| 219 | + | |
| 220 | + | |
147 | 221 | | |
148 | 222 | | |
149 | | - | |
| 223 | + | |
150 | 224 | | |
151 | 225 | | |
152 | 226 | | |
153 | 227 | | |
154 | | - | |
| 228 | + | |
155 | 229 | | |
156 | 230 | | |
157 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
0 commit comments