Skip to content

avoid-db-writes-sorting-by-score#1179

Open
bodoque-01 wants to merge 1 commit intoajeetdsouza:mainfrom
bodoque-01:avoid-db-writes-sorting-score
Open

avoid-db-writes-sorting-by-score#1179
bodoque-01 wants to merge 1 commit intoajeetdsouza:mainfrom
bodoque-01:avoid-db-writes-sorting-score

Conversation

@bodoque-01
Copy link
Copy Markdown

Currently, sort_by_score unconditionally marks the database as dirty, even if it just sorted the data (thus persisting does not change)

This causes z foo query calls to trigger a disk write even when no entries were added, removed, or lazily deleted. Since sort order is recomputed fresh on every open, there is nothing meaningful to persist in these cases.

Changes

-Removed dirty-marking from sort_by_score in db/mod.rs
-Added an explicit mark_dirty() method to Database
-Updated cmd/edit.rs to call mark_dirty() before save(), since the edit workflow requires the sorted DB to be written to disk before launching fzf (the reload subprocess reads it back)

Basically, this just avoids unnecessary disk writes on every z query by not marking the DB dirty on sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant