Is there a better way to iterate through a dict while comparing against a list of values?

Consider a fixed list of keys and a dictionary of random key/values. I have to iterate through the dictionary and if a key is not in the list (keys that may or may not exist in the dictionary), then I add it to a new dictionary.

d = {'key1': '1', 'keyA': 'A', 'key2': '2', 'keyB': 'B', ...}
new_d = {}

for k, v in d.items():
    if k not in ['key1', 'keyB', 'key_doesnotexist']:
        new_d[k] = v

To optimize this, I thought about iterating through the list of keys first and popping anything that matches the list to get rid of the inner loop so something like this:

d = {'key1': '1', 'keyA': 'A', 'key2': '2', 'keyB': 'B', ...}
new_d = {}

for x in ['key1', 'keyB', 'key_doesnotexist']:
    d.pop(x, default=None)

for k, v in d.items():
    new_d[k] = v

Just wondering if there are any faster methods I should be aware of.

Answer

This might work faster:

d = {'key1': '1', 'keyA': 'A', 'key2': '2', 'keyB': 'B'}
new_d = {k: d[k] for k in d.keys() - ['key1', 'keyB', 'key_doesnotexist']}

Prints:

>>> new_d
{'keyA': 'A', 'key2': '2'}