FuelLabs / fuel-core

Rust full node implementation of the Fuel v2 protocol.
Other
58.17k stars 2.76k forks source link

chore(db_lookup_times): Modify benchmarks to use `TableBlueprint` to avoid manual serde #2169

Open rymnc opened 1 week ago

rymnc commented 1 week ago

In https://github.com/FuelLabs/fuel-core/pull/2142 we introduced benchmarks that were not too clean, and part of the rework has been addressed in -

The last part of the rework involves implementing TableWithBlueprint ~ https://github.com/FuelLabs/fuel-core/blob/f5240cb8baa8210c7b744a49d96695df0c84b2f1/crates/storage/src/structured_storage.rs#L74-L82

for the custom columns we have defined in the benchmarks ~ https://github.com/FuelLabs/fuel-core/blob/e09f9f10358a2ea40043eca1986b3f8a30291502/benches/src/db_lookup_times_utils/full_block_table.rs#L18-L25

so that we can use KeyValueInspect and KeyValueMutate storage traits ~ https://github.com/FuelLabs/fuel-core/blob/f5240cb8baa8210c7b744a49d96695df0c84b2f1/crates/storage/src/kv_store.rs#L49-L90 & https://github.com/FuelLabs/fuel-core/blob/f5240cb8baa8210c7b744a49d96695df0c84b2f1/crates/storage/src/kv_store.rs#L127-L167

to get/put data from the tables in batches without doing manual serde.

It is suggested to use Plain<Primitive<4>, Postcard> for the Blueprint associated type in the impls of TableWithBlueprint

xgreenx commented 1 week ago

And it would be nice to insert transactions and blocks by using InMemoryTransaction to speed up seeding=)