From 4fbb7875fb92e2eaa7b666d79d4e6cc3e741e450 Mon Sep 17 00:00:00 2001 From: Thomas Mathews Date: Wed, 28 Dec 2022 10:07:00 -0800 Subject: [PATCH] Performance Update I am disabling saving events as it seems quite stressful on IndexedDB as well as having to parse everything. We need some smart saving where we only save data relative to the user. Such as profiles last seen within the day or so. Anything else can simply be refetched. Storing 50,000 events does not really help the app that much, but does give it a better loading start. --- js/main.js | 10 +++++----- js/ui/state.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index debe539..2f070be 100644 --- a/js/main.js +++ b/js/main.js @@ -98,13 +98,13 @@ async function webapp_init() { // Load all events from storage and re-process them so that apply correct // effects. - await model_load_events(model, (ev)=> { + /*await model_load_events(model, (ev)=> { model_process_event(model, undefined, ev); }); log_debug("loaded events", Object.keys(model.all_events).length); // Update our view and apply timer methods once all data is ready to go. - view_timeline_update(model); + view_timeline_update(model);*/ view_timeline_apply_mode(model, VM_FRIENDS); on_timer_timestamps(); on_timer_invalidations(); @@ -126,16 +126,16 @@ function on_timer_invalidations() { if (DAMUS.invalidated.length > 0) view_timeline_update(DAMUS); on_timer_invalidations(); - }, 100); + }, 50); } function on_timer_save() { setTimeout(() => { const model = DAMUS; - model_save_events(model); + //model_save_events(model); model_save_settings(model); on_timer_save(); - }, 10 * 1000); + }, 1 * 1000); } function on_timer_tick() { diff --git a/js/ui/state.js b/js/ui/state.js index 6d80748..c0c0a07 100644 --- a/js/ui/state.js +++ b/js/ui/state.js @@ -120,7 +120,7 @@ function view_timeline_update(model) { const latest_ev = el.firstChild ? model.all_events[el.firstChild.id.slice(2)] : undefined; const left_overs = []; - while (model.invalidated.length > 0) { + while (model.invalidated.length > 0 && count < 500) { var evid = model.invalidated.pop(); // Remove deleted events first