Two small per-object-per-frame improvements in the tracker hot path
(match_and_update), both bit-identical:
- get_stationary_threshold returned a freshly constructed StationaryThresholds
(a dataclass plus a list) on every call for any label not in the three
known lists - i.e. for common labels like person/dog. The default thresholds
are constant and never mutated, so return a shared module-level singleton,
as the other three cases already do.
- untracked_object_boxes membership used `box not in [list of boxes]` (O(n));
build a set of box tuples for O(1) membership. Boxes are hashable as tuples
and output is unchanged.
get_stationary_threshold appeared in a live py-spy --gil profile of a camera
process_frames worker. Adds tests for the threshold lookups.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>