Avoid unnecessary DB writes (#29417)
Part of https://github.com/zed-industries/zed/issues/16472 * Adds debug logging to everywhere near INSERT/UPDATEs in the DB So something like `env RUST_LOG=debug,wasmtime_cranelift=off,cranelift_codegen=off,vte=off cargo run` could be used to view these (current zlog seems to process the exclusions odd, so not sure this is the optimal RUST_LOG line) can be used to debug any further writes. * Removes excessive window stack serialization Previously, it serialized unconditionally every 100ms. Now, only if the stack had changed, which is now check every 500ms. * Removes excessive terminal serialization Previously, it serialized its `cwd` on every `ItemEvent::UpdateTab` which was caused by e.g. any character output. Now, only if the `cwd` has changed at the next event processing time. Release Notes: - Fixed more excessive DB writes
This commit is contained in:
parent
37fa437990
commit
f106dfca42
16 changed files with 224 additions and 168 deletions
|
@ -1251,6 +1251,7 @@ impl SerializableItem for Editor {
|
|||
language,
|
||||
mtime,
|
||||
};
|
||||
log::debug!("Serializing editor {item_id:?} in workspace {workspace_id:?}");
|
||||
DB.save_serialized_editor(item_id, workspace_id, editor)
|
||||
.await
|
||||
.context("failed to save serialized editor")
|
||||
|
|
|
@ -276,6 +276,7 @@ impl EditorDb {
|
|||
workspace_id: WorkspaceId,
|
||||
selections: Vec<(usize, usize)>,
|
||||
) -> Result<()> {
|
||||
log::debug!("Saving selections for editor {editor_id} in workspace {workspace_id:?}");
|
||||
let mut first_selection;
|
||||
let mut last_selection = 0_usize;
|
||||
for (count, placeholders) in std::iter::once("(?1, ?2, ?, ?)")
|
||||
|
@ -327,6 +328,7 @@ VALUES {placeholders};
|
|||
workspace_id: WorkspaceId,
|
||||
folds: Vec<(usize, usize)>,
|
||||
) -> Result<()> {
|
||||
log::debug!("Saving folds for editor {editor_id} in workspace {workspace_id:?}");
|
||||
let mut first_fold;
|
||||
let mut last_fold = 0_usize;
|
||||
for (count, placeholders) in std::iter::once("(?1, ?2, ?, ?)")
|
||||
|
|
|
@ -270,6 +270,9 @@ impl ScrollManager {
|
|||
|
||||
cx.foreground_executor()
|
||||
.spawn(async move {
|
||||
log::debug!(
|
||||
"Saving scroll position for item {item_id:?} in workspace {workspace_id:?}"
|
||||
);
|
||||
DB.save_scroll_position(
|
||||
item_id,
|
||||
workspace_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue