global: fixes + snapshot + packages

This commit is contained in:
nym21
2025-04-26 17:22:58 +02:00
parent 07618ebe43
commit 82bcc55645
44 changed files with 6462 additions and 1973 deletions

View File

@@ -58,10 +58,9 @@ Stores: `src/storage/stores/mod.rs`
## Benchmark
### Result 1 - 2025-04-12
### `v0.0.21`
- version: `v0.0.21`
- machine: `Macbook Pro M3 Pro (36GB RAM)`
- machine: `MBP M3 Pro (36GB RAM)`
- mode: `raw`
- from: `0`
- to: `892_098`
@@ -69,3 +68,10 @@ Stores: `src/storage/stores/mod.rs`
- peak memory: `6.1GB`
- disk usage: `270 GB`
- overhead: `36%` (`270 GB / 741 GB`)
### `v0.0.31`
- machine: `MBP M3 Pro (36GB RAM)`
- mode: `raw`
- disk usage: `208 GB`
- overhead: `28%` (`208 GB / 744 GB`)

View File

@@ -32,7 +32,7 @@ pub use stores::*;
pub use vecs::*;
const SNAPSHOT_BLOCK_RANGE: usize = 1000;
const COLLISIONS_CHECKED_UP_TO: u32 = 0;
const COLLISIONS_CHECKED_UP_TO: u32 = 893_000;
#[derive(Clone)]
pub struct Indexer {
@@ -166,39 +166,35 @@ impl Indexer {
vecs.height_to_blockhash.push_if_needed(height, blockhash)?;
vecs.height_to_difficulty
.push_if_needed(height, block.header.difficulty_float())?;
.push_if_needed(height, block.header.difficulty_float().into())?;
vecs.height_to_timestamp
.push_if_needed(height, Timestamp::from(block.header.time))?;
vecs.height_to_total_size.push_if_needed(height, block.total_size().into())?;
vecs.height_to_weight.push_if_needed(height, block.weight().into())?;
let (inputs, outputs) = thread::scope(|s| {
let inputs_handle = s.spawn(|| block
.txdata
.iter()
.enumerate()
.flat_map(|(index, tx)| {
tx.input
.iter()
.enumerate()
.map(move |(vin, txin)| (TxIndex::from(index), Vin::from(vin), txin, tx))
})
.collect::<Vec<_>>());
let inputs = block
.txdata
.iter()
.enumerate()
.flat_map(|(index, tx)| {
tx.input
.iter()
.enumerate()
.map(move |(vin, txin)| (TxIndex::from(index), Vin::from(vin), txin, tx))
})
.collect::<Vec<_>>();
let outputs_handle = s.spawn(|| block
.txdata
.iter()
.enumerate()
.flat_map(|(index, tx)| {
tx.output
.iter()
.enumerate()
.map(move |(vout, txout)| (TxIndex::from(index), Vout::from(vout), txout, tx))
})
.collect::<Vec<_>>());
(inputs_handle.join().unwrap(), outputs_handle.join().unwrap())
});
let outputs = block
.txdata
.iter()
.enumerate()
.flat_map(|(index, tx)| {
tx.output
.iter()
.enumerate()
.map(move |(vout, txout)| (TxIndex::from(index), Vout::from(vout), txout, tx))
})
.collect::<Vec<_>>();
let tx_len = block.txdata.len();
let outputs_len = outputs.len();

View File

@@ -4,8 +4,8 @@ use brk_core::{
AddressBytes, BlockHash, EmptyOutputIndex, Height, InputIndex, OpReturnIndex, OutputIndex,
OutputType, OutputTypeIndex, P2ABytes, P2AIndex, P2MSIndex, P2PK33Bytes, P2PK33Index,
P2PK65Bytes, P2PK65Index, P2PKHBytes, P2PKHIndex, P2SHBytes, P2SHIndex, P2TRBytes, P2TRIndex,
P2WPKHBytes, P2WPKHIndex, P2WSHBytes, P2WSHIndex, RawLockTime, Sats, StoredU32, StoredUsize,
Timestamp, TxIndex, TxVersion, Txid, UnknownOutputIndex, Weight,
P2WPKHBytes, P2WPKHIndex, P2WSHBytes, P2WSHIndex, RawLockTime, Sats, StoredF64, StoredU32,
StoredUsize, Timestamp, TxIndex, TxVersion, Txid, UnknownOutputIndex, Weight,
};
use brk_vec::{AnyStoredVec, Compressed, Result, Version};
use rayon::prelude::*;
@@ -20,7 +20,7 @@ pub use base::*;
pub struct Vecs {
pub emptyoutputindex_to_txindex: IndexedVec<EmptyOutputIndex, TxIndex>,
pub height_to_blockhash: IndexedVec<Height, BlockHash>,
pub height_to_difficulty: IndexedVec<Height, f64>,
pub height_to_difficulty: IndexedVec<Height, StoredF64>,
pub height_to_first_emptyoutputindex: IndexedVec<Height, EmptyOutputIndex>,
pub height_to_first_inputindex: IndexedVec<Height, InputIndex>,
pub height_to_first_opreturnindex: IndexedVec<Height, OpReturnIndex>,