mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 07:17:56 -05:00
perf(era-utils): replace Box<dyn Fn> with function pointer (#20701)
This commit is contained in:
@@ -170,18 +170,14 @@ where
|
|||||||
<P as NodePrimitivesProvider>::Primitives: NodePrimitives<BlockHeader = BH, BlockBody = BB>,
|
<P as NodePrimitivesProvider>::Primitives: NodePrimitives<BlockHeader = BH, BlockBody = BB>,
|
||||||
{
|
{
|
||||||
let reader = open(meta)?;
|
let reader = open(meta)?;
|
||||||
let iter =
|
let iter = reader.iter().map(decode as fn(_) -> _);
|
||||||
reader
|
|
||||||
.iter()
|
|
||||||
.map(Box::new(decode)
|
|
||||||
as Box<dyn Fn(Result<BlockTuple, E2sError>) -> eyre::Result<(BH, BB)>>);
|
|
||||||
let iter = ProcessIter { iter, era: meta };
|
let iter = ProcessIter { iter, era: meta };
|
||||||
|
|
||||||
process_iter(iter, writer, provider, hash_collector, block_numbers)
|
process_iter(iter, writer, provider, hash_collector, block_numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProcessInnerIter<R, BH, BB> =
|
type ProcessInnerIter<R, BH, BB> =
|
||||||
Map<BlockTupleIterator<R>, Box<dyn Fn(Result<BlockTuple, E2sError>) -> eyre::Result<(BH, BB)>>>;
|
Map<BlockTupleIterator<R>, fn(Result<BlockTuple, E2sError>) -> eyre::Result<(BH, BB)>>;
|
||||||
|
|
||||||
/// An iterator that wraps era file extraction. After the final item [`EraMeta::mark_as_processed`]
|
/// An iterator that wraps era file extraction. After the final item [`EraMeta::mark_as_processed`]
|
||||||
/// is called to ensure proper cleanup.
|
/// is called to ensure proper cleanup.
|
||||||
|
|||||||
Reference in New Issue
Block a user