Skip to main content

Module optimizations

Module optimizations 

Source
Expand description

Production-only batch hashing, preallocation, and related optimization helpers from consensus.

Modules§

_optimized_access
Alias module for _optimized_access (for backward compatibility)
constant_folding
Constant folding: Pre-compute common hash results
dead_code_elimination
Dead code elimination markers
optimized_access
Optimized access using proven bounds
precomputed_constants
Pre-computed constants for constant folding optimization
prefetch
Memory prefetching optimization
proven_bounds
Proven bounds for runtime optimization
reference_implementations
Reference implementations for equivalence proofs
runtime_assertions
Runtime assertions for optimization correctness
simd_vectorization
SIMD Vectorization: Batch hash operations

Structs§

CacheAlignedHash
Memory layout optimization: Cache-friendly hash array
CompactStackFrame
Memory layout optimization: Compact stack frame

Constants§

BTC_PER_SATOSHI
Pre-computed: Inverse of SATOSHIS_PER_BTC (for BTC conversion)
EMPTY_STRING_DOUBLE_HASH
Pre-computed: Double SHA256 of empty string
EMPTY_STRING_HASH
Pre-computed: SHA256 of empty string
MAX_MONEY_U64
Pre-computed: MAX_MONEY as u64 (for comparisons)
ONE_BTC_SATOSHIS
Pre-computed: Number of satoshis in 1 BTC (for readability)
U32_MAX
Pre-computed: 2^32 - 1 (for 32-bit wrapping checks)
U64_MAX
Pre-computed: 2^64 - 1 (used for wrapping arithmetic checks)

Functions§

is_empty_double_hash
Check if input matches empty string double hash (constant folding)
is_empty_hash
Check if input matches empty string hash (constant folding)
is_zero_hash
Constant-fold: Check if hash is zero (all zeros)
prealloc_block_buffer
Pre-allocate block buffer using proven maximum
prealloc_tx_buffer
Pre-allocate transaction buffer using proven maximum