Iterate over custom properties without searching? If I understand the way it works, accessing a property by string (data["propname"] = 0) requires the system to search for it. Iterating over all of the properties in data, comparing the id-string until the correct one is found. But what about when we are already iterating over every property?

for key in a.keys():
    a[key] = b[key]


This type of situation seems like it would be very inefficient. Especially if every access requires a search. Even if some type of hashing is automatically kicking in, it seems pretty wasteful. Is it possible to do this in a way that makes more sense? Some type of property iterator? Or any type of index or reference to the property that relates to the next one in the same structure?

If not, would it be possible to build any type of lookup table or helper utility for a situation where you need to iterate the same set of properties for many objects?
It is correct that accessing values by key using .get() on bpy.types.struct iterates through the elements. The function that gets called through the Python API is pyrna_struct_get() (bpy_rna.c). It uses IDP_GetPropertyFromGroup() (idprop.c) which in turn calls BLI_findstring(listbase.c). As the name already suggests it performs string comparisons by iterating through a list.

It should be avoided iterating over the keys and then accessing the values, both in Blender and also Python software that uses actual dictionaries as data structure. As batFINGER suggested you could use a.items() instead.

for key, value in a.items():
    # do something with either key or value
    pass