From 59d68f92c48b56f83322bfd744a78b0c6faaafae Mon Sep 17 00:00:00 2001 From: YK Date: Tue, 3 Feb 2026 22:29:07 +0800 Subject: [PATCH] perf(static-file): hoist cursor creation outside block loop (#21731) --- crates/static-file/static-file/src/segments/receipts.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/static-file/static-file/src/segments/receipts.rs b/crates/static-file/static-file/src/segments/receipts.rs index b09dadd1ea..b40cc08f0c 100644 --- a/crates/static-file/static-file/src/segments/receipts.rs +++ b/crates/static-file/static-file/src/segments/receipts.rs @@ -30,6 +30,10 @@ where let mut static_file_writer = provider.get_static_file_writer(*block_range.start(), StaticFileSegment::Receipts)?; + let mut receipts_cursor = provider + .tx_ref() + .cursor_read::::Receipt>>()?; + for block in block_range { static_file_writer.increment_block(block)?; @@ -37,10 +41,6 @@ where .block_body_indices(block)? .ok_or(ProviderError::BlockBodyIndicesNotFound(block))?; - let mut receipts_cursor = provider - .tx_ref() - .cursor_read::::Receipt>>( - )?; let receipts_walker = receipts_cursor.walk_range(block_body_indices.tx_num_range())?; static_file_writer.append_receipts(