Prefilter more logbook events in sql (#36958)

* Prefilter more logbook events in sql

Prefilter sensor events in _keep_event before humanify

Cache static attribute lookup

Reduces logbook execution time by ~35%

* fix mocking in benchmark

* Update tests for logbook users
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-06-21 10:50:58 -07:00
1 parent 29f128eaad
commit 59e43ab6e4
7 files changed
+275 -108

No files matched your search

+2
View File
@@ -10,6 +10,7 @@ async def test_humanify_alexa_event(hass):
"""Test humanifying Alexa event."""
await async_setup_component(hass, "alexa", {})
hass.states.async_set("light.kitchen", "on", {"friendly_name": "Kitchen Light"})
entity_attr_cache = logbook.EntityAttributeCache(hass)
results = list(
logbook.humanify(
@@ -40,6 +41,7 @@ async def test_humanify_alexa_event(hass):
},
),
],
entity_attr_cache,
)
)