Performance of argparse.Namespace is unstable across versions, platforms, and there are some other strange things going on there that I haven’t got to the bottom of it yet. (One of the reasons for it is that I don’t know which one I should focus on improving)
See: 1. AttrDict and 2. argparse.Namespace performance
3.14 main, OSX:
❯ ./python.exe -m timeit -s 'import types; a = types.SimpleNamespace(a=1)' 'a.a'
5000000 loops, best of 5: 41.5 nsec per loop
❯ ./python.exe -m timeit -s 'import argparse; a = argparse.Namespace(a=1)' 'a.a'
20000000 loops, best of 5: 12.2 nsec per loop