Reduce overhead connect dispatcher
- We tend to have 1000s (or 10000s) of connected dispatchers which
makes these prime targets to reduce overhead/memory
- Instead of creating new functions to wrap log exceptions each time
use partials which reuses the function body and only create new
arguments
Previous optimizations #103307#93602
* Fix memory leak in dispatcher removal
When we removed the last job/callable from the dict for the
signal we did not remove the dict for the signal which meant
it leaked
* comment
* cleanup a bit more
* Switch dispatcher to use async_run_hass_job
- Since we already wrap all the callbacks in catch_log_exception
we can use async_run_hass_job here
- The overhead of wrapping the call in a call_soon, queuing it
and running it later usually exceeds the overhead of running
the job itself
* fix size change during iteration
* fix out of order send
* fix missing mocking in unifi test
* Fix Legrand Home+ Control updating entities before the coordinator update had finished
* stray debug
* Test typing for helpers.__init__ and temperature
* Add type hints to helpers.sun
* Add type hints to helpers.signal
* Add type hints to helpers.entity_values
* Add type hints to helpers.dispatcher