Improving Python script processing speed (performance)?

I think there may be unavoidable cursor transaction overhead to slow you down unless there is a way to update a large batch of rows at once. Comment out "cur.updaterow(row)" and run it again... is there a difference?

The secondary slow down in your case is a lot of unnecessary copying. dict.keys() copies values and you have many. Better to do "if k in dict" and "for k in dict" which compares your value k to the dict's keys.

Can you also avoid all the str(int(foo)) expressions? If foo is already a string representation of an int, you can save many (millions?) of calls.