A bottleneck to the constant factor of detector annotation is the implementation of the PauliString class. It's currently a dictionary mapping qubits to strings. Some of the frequently used methods, such as anticommutes() and collapse_by() should really just be XORs, but are currently an iterative process involving many dictionary lookups. There are also frequent conversions from/to stim.PauliString, causing overheads.
In principle, the class can be replaced/reimplemented by stim.PauliString, a numpy array, or simply a Python int representing a bit array, where the information about the qubits is stored in BoundaryStabilizer or handled in some other way.
A bottleneck to the constant factor of detector annotation is the implementation of the
PauliStringclass. It's currently a dictionary mapping qubits to strings. Some of the frequently used methods, such asanticommutes()andcollapse_by()should really just be XORs, but are currently an iterative process involving many dictionary lookups. There are also frequent conversions from/tostim.PauliString, causing overheads.In principle, the class can be replaced/reimplemented by
stim.PauliString, a numpy array, or simply a Pythonintrepresenting a bit array, where the information about the qubits is stored inBoundaryStabilizeror handled in some other way.