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.
This commit is contained in:
Thomas Mathews 2022-12-28 10:07:00 -08:00
parent cf95d29184
commit 4fbb7875fb
2 changed files with 6 additions and 6 deletions

View file

@ -98,13 +98,13 @@ async function webapp_init() {
// Load all events from storage and re-process them so that apply correct // Load all events from storage and re-process them so that apply correct
// effects. // effects.
await model_load_events(model, (ev)=> { /*await model_load_events(model, (ev)=> {
model_process_event(model, undefined, ev); model_process_event(model, undefined, ev);
}); });
log_debug("loaded events", Object.keys(model.all_events).length); log_debug("loaded events", Object.keys(model.all_events).length);
// Update our view and apply timer methods once all data is ready to go. // 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); view_timeline_apply_mode(model, VM_FRIENDS);
on_timer_timestamps(); on_timer_timestamps();
on_timer_invalidations(); on_timer_invalidations();
@ -126,16 +126,16 @@ function on_timer_invalidations() {
if (DAMUS.invalidated.length > 0) if (DAMUS.invalidated.length > 0)
view_timeline_update(DAMUS); view_timeline_update(DAMUS);
on_timer_invalidations(); on_timer_invalidations();
}, 100); }, 50);
} }
function on_timer_save() { function on_timer_save() {
setTimeout(() => { setTimeout(() => {
const model = DAMUS; const model = DAMUS;
model_save_events(model); //model_save_events(model);
model_save_settings(model); model_save_settings(model);
on_timer_save(); on_timer_save();
}, 10 * 1000); }, 1 * 1000);
} }
function on_timer_tick() { function on_timer_tick() {

View file

@ -120,7 +120,7 @@ function view_timeline_update(model) {
const latest_ev = el.firstChild ? const latest_ev = el.firstChild ?
model.all_events[el.firstChild.id.slice(2)] : undefined; model.all_events[el.firstChild.id.slice(2)] : undefined;
const left_overs = []; const left_overs = [];
while (model.invalidated.length > 0) { while (model.invalidated.length > 0 && count < 500) {
var evid = model.invalidated.pop(); var evid = model.invalidated.pop();
// Remove deleted events first // Remove deleted events first