Skip to main content

parse_log_optimized

Function parse_log_optimized 

Source
pub fn parse_log_optimized(
    log: &str,
    signature: Signature,
    slot: u64,
    tx_index: u64,
    block_time_us: Option<i64>,
    grpc_recv_us: i64,
    event_type_filter: Option<&EventTypeFilter>,
    is_created_buy: bool,
) -> Option<DexEvent>
Expand description

Optimized unified log parser with single-decode, early-filter strategy

Performance Strategy:

  1. Decode base64 ONCE to stack buffer (~100ns)
  2. Extract discriminator from decoded data (~5ns)
  3. Check filter BEFORE parsing fields - return None if not wanted
  4. Parse only the specific event type requested

Key optimization: NO double base64 decoding! Old: extract_discriminator(decode) -> parser(decode again) = 2x decode New: decode once -> check filter -> parse from buffer = 1x decode