Walk me through how you would optimize a list view that displays thousands of live-updating financial records in a Bloomberg mobile app.
Implement process_live_records(records, events). records is an ordered array of [record_id, value] pairs. Each event is either an update containing type, record_id, and value, or a viewport request containing type, start, and size. Return an array of snapshots for viewport requests in event order. Updates must modify the matching record without changing order. Use an approach that avoids scanning all records for each update.
Inputs are valid, record identifiers are unique, and updates reference existing records.
def process_live_records(records, events):