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:
- Decode base64 ONCE to stack buffer (~100ns)
- Extract discriminator from decoded data (~5ns)
- Check filter BEFORE parsing fields - return None if not wanted
- 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