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
impl Options
sourcepub fn order_output(self) -> Self
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.
sourcepub fn num_threads(self, n: usize) -> Self
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.
sourcepub fn batch_size(self, n: usize) -> Self
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
sourcepub fn channel_buffer_size(self, n: usize) -> Self
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.
Trait Implementations§
source§impl Default for Options
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