Optimize the following Python code to maximize performance.
for row in records:
    for key, value in row.items():
        do_something(key, value)
for row in records:
    for key, value in row.items():
        try:
            do_something(key, value)
        except Exception:
            pass