mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-14 11:40:44 +00:00
af67bd5968
Priority 1: Session.compact() walked all self.messages to count user-role
messages. For a 2,730-msg session that's ~1.5s on eMMC. Replaced with
Session._compute_user_message_count_lazy(): single indexed SQLite query,
~5ms, same correctness. Field is consumed by sidebar-row code
(_looks_like_stale_zero_message_row, _row_may_need_sidecar_metadata_refresh)
so we MUST keep emitting a real value, not None.
Priority 4: _LIST_PROFILES_CACHE_TTL 4s -> 60s. Invalidation hooks
(create_profile_api, delete_profile_api) already call
_invalidate_list_profiles_cache() so the bump is safe.
Bench (10 iters, 10s timeout, live Chromebook eMMC):
long_session_idle p50 5759ms -> 2869ms (-50%)
p95 9141ms -> 3156ms (-65%)
max 9740ms -> 3283ms (-66%)
timeouts 2/10 -> 0/10
session_switch_idle p50 2336ms -> 1316ms (-44%)
p95 3708ms -> 1442ms (-61%)
max 4218ms -> 1525ms (-64%)
profiles_idle p50 6ms -> 6ms
p95 821ms -> 248ms (-70%)
max 1488ms -> 445ms (-70%)
sidebar_idle p50 123ms -> 31ms (-75%)
p95 887ms -> 57ms (-94%)
max 986ms -> 59ms (-94%)
normal_session_idle p50 359ms -> 56ms (-84%)
p95 749ms -> 131ms (-83%)
max 794ms -> 167ms (-79%)
Revert: git checkout master && systemctl --user restart hermes-webui