computer + kibo: part 11

This commit is contained in:
nym21
2025-04-14 16:27:22 +02:00
parent 1c75ea046c
commit 942431e882
19 changed files with 1249 additions and 856 deletions

View File

@@ -58,13 +58,14 @@ Stores: `src/storage/stores/mod.rs`
## Benchmark
### Result 1 - 2025-04-10
### Result 1 - 2025-04-12
- version: `v0.0.20`
- version: `v0.0.21`
- machine: `Macbook Pro M3 Pro (36GB RAM)`
- mode: `raw`
- from: `0`
- to: `891_810`
- time: `8 hours 27 min 3s`
- peak memory: `6.5GB`
- to: `892_098`
- time: `7 hours 10 min 22s`
- peak memory: `6.1GB`
- disk usage: `270 GB`
- overhead: `36%` (`270 GB / 741 GB`)

View File

@@ -81,7 +81,7 @@ impl Indexer {
self.stores.as_ref().unwrap(),
rpc,
))
.unwrap_or_else(|_| {
.unwrap_or_else(|_report| {
let indexes = Indexes::default();
indexes.push_if_needed(self.vecs.as_mut().unwrap()).unwrap();
indexes
@@ -165,8 +165,8 @@ impl Indexer {
.push_if_needed(height, block.header.difficulty_float())?;
vecs.height_to_timestamp
.push_if_needed(height, Timestamp::from(block.header.time))?;
vecs.height_to_block_size.push_if_needed(height, block.total_size().into())?;
vecs.height_to_block_weight.push_if_needed(height, block.weight().into())?;
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 = block
.txdata

View File

@@ -98,10 +98,10 @@ where
if !self.puts.is_empty() {
unreachable!("Shouldn't reach this");
// self.puts.remove(&key);
}
// dbg!(&key);
if !self.dels.insert(key) {
if !self.dels.insert(key.clone()) {
dbg!(key, &self.meta.path());
unreachable!();
}
}

View File

@@ -46,6 +46,10 @@ impl StoreMeta {
self.len() == 0
}
pub fn version(&self) -> Version {
self.version
}
pub fn export(&mut self, len: usize, height: Height) -> io::Result<()> {
self.len = len;
self.write_length()?;
@@ -61,6 +65,10 @@ impl StoreMeta {
fs::create_dir(path)
}
pub fn path(&self) -> &Path {
&self.pathbuf
}
fn path_version(&self) -> PathBuf {
Self::path_version_(&self.pathbuf)
}

View File

@@ -49,6 +49,10 @@ where
pub fn cached_get(&mut self, index: I) -> Result<Option<Value<'_, T>>> {
self.inner.cached_get(index)
}
#[inline]
pub fn cached_get_(&mut self, index: usize) -> Result<Option<Value<'_, T>>> {
self.inner.cached_get_(index)
}
pub fn iter_from<F>(&mut self, index: I, f: F) -> Result<()>
where

View File

@@ -40,9 +40,9 @@ pub struct Vecs {
pub height_to_first_txinindex: IndexedVec<Height, Txinindex>,
pub height_to_first_txoutindex: IndexedVec<Height, Txoutindex>,
pub height_to_first_unknownindex: IndexedVec<Height, Unknownindex>,
pub height_to_block_size: IndexedVec<Height, StoredUsize>,
pub height_to_total_size: IndexedVec<Height, StoredUsize>,
pub height_to_timestamp: IndexedVec<Height, Timestamp>,
pub height_to_block_weight: IndexedVec<Height, Weight>,
pub height_to_weight: IndexedVec<Height, Weight>,
pub multisigindex_to_height: IndexedVec<Multisigindex, Height>,
pub opreturnindex_to_height: IndexedVec<Opreturnindex, Height>,
pub p2pk33index_to_height: IndexedVec<P2PK33index, Height>,
@@ -188,8 +188,8 @@ impl Vecs {
Version::ZERO,
compressed,
)?,
height_to_block_size: IndexedVec::forced_import(
&path.join("height_to_block_size"),
height_to_total_size: IndexedVec::forced_import(
&path.join("height_to_total_size"),
Version::ZERO,
compressed,
)?,
@@ -198,8 +198,8 @@ impl Vecs {
Version::ZERO,
compressed,
)?,
height_to_block_weight: IndexedVec::forced_import(
&path.join("height_to_block_weight"),
height_to_weight: IndexedVec::forced_import(
&path.join("height_to_weight"),
Version::ZERO,
compressed,
)?,
@@ -431,11 +431,11 @@ impl Vecs {
.truncate_if_needed(height, saved_height)?;
self.height_to_difficulty
.truncate_if_needed(height, saved_height)?;
self.height_to_block_size
self.height_to_total_size
.truncate_if_needed(height, saved_height)?;
self.height_to_timestamp
.truncate_if_needed(height, saved_height)?;
self.height_to_block_weight
self.height_to_weight
.truncate_if_needed(height, saved_height)?;
self.addressindex_to_addresstype
@@ -631,9 +631,9 @@ impl Vecs {
self.height_to_first_p2trindex.any_vec(),
self.height_to_first_p2wpkhindex.any_vec(),
self.height_to_first_p2wshindex.any_vec(),
self.height_to_block_size.any_vec(),
self.height_to_total_size.any_vec(),
self.height_to_timestamp.any_vec(),
self.height_to_block_weight.any_vec(),
self.height_to_weight.any_vec(),
self.p2pk33index_to_p2pk33addressbytes.any_vec(),
self.p2pk65index_to_p2pk65addressbytes.any_vec(),
self.p2pkhindex_to_p2pkhaddressbytes.any_vec(),
@@ -693,9 +693,9 @@ impl Vecs {
&mut self.height_to_first_p2trindex,
&mut self.height_to_first_p2wpkhindex,
&mut self.height_to_first_p2wshindex,
&mut self.height_to_block_size,
&mut self.height_to_total_size,
&mut self.height_to_timestamp,
&mut self.height_to_block_weight,
&mut self.height_to_weight,
&mut self.p2pk33index_to_p2pk33addressbytes,
&mut self.p2pk65index_to_p2pk65addressbytes,
&mut self.p2pkhindex_to_p2pkhaddressbytes,