Struct bitcoin_block_parser::blocks::Options

source ·
pub struct Options { /* private fields */ }
Expand description

Options to tune the performance of the parser, generally you can stick to the defaults unless you run into memory issues.

Implementations§

source§

impl Options

source

pub fn order_output(self) -> Self

Ensures that the output of the BlockParser::parse function will be in block height order.

Some algorithms require BlockParser::batch to process blocks in-order, however this requires running that function in a single thread. BlockParser::extract will still run multithreaded out-of-order.

source

pub fn num_threads(self, n: usize) -> Self

Set the number of threads to handle the processing steps.

Typically limited by disk I/O and the number of threads your system can handle, increasing it generally improves speed at the cost of memory usage.

source

pub fn batch_size(self, n: usize) -> Self

Number of items passed into BlockParser::batch.

If you need to access shared state through an Arc<Mutex<_>> a bigger batch size can improve performance, at the cost of more memory depending on the size of BlockParser::extract

source

pub fn channel_buffer_size(self, n: usize) -> Self

Set the number of size of the buffers used between channels.

Doesn’t have a significant impact on speed/memory so long as it’s set high enough.

source

pub fn log_at(self, n: usize) -> Self

Set how many blocks to parse before printing a log message out.

To disable logging, simply set log_at to usize::MAX, required to be at least 1K

Trait Implementations§

source§

impl Default for Options

Defaults that should be close to optimal for most parsers

num_threads: 128 should be enough for most systems regardless of disk speed batch_size: 10 improves batch performance without using too much memory channel_buffer_size: 100 increasing beyond this usually just increases memory usage log_at: 10_000 will produce logs every few seconds without spamming output

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V