Small speed up to logbook humanify (#117854)

This commit is contained in:
J. Nick Koston 2024-05-21 03:10:20 -10:00 committed by GitHub
parent e12d23bd48
commit 0112c7fcfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -204,13 +204,12 @@ def _humanify(
include_entity_name = logbook_run.include_entity_name include_entity_name = logbook_run.include_entity_name
format_time = logbook_run.format_time format_time = logbook_run.format_time
memoize_new_contexts = logbook_run.memoize_new_contexts memoize_new_contexts = logbook_run.memoize_new_contexts
memoize_context = context_lookup.setdefault
# Process rows # Process rows
for row in rows: for row in rows:
context_id_bin: bytes = row.context_id_bin context_id_bin: bytes = row.context_id_bin
if memoize_new_contexts: if memoize_new_contexts and context_id_bin not in context_lookup:
memoize_context(context_id_bin, row) context_lookup[context_id_bin] = row
if row.context_only: if row.context_only:
continue continue
event_type = row.event_type event_type = row.event_type