You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Atomic write should not be enabled for all usages of vscode-userdata #192970
While looking into Peng Lyu (@rebornix) question in #167719 (comment), I noticed how now all writes triggered from vscode-userdata scheme have atomic: true:
Since backups use this scheme, every time an editor is dirty and backs up, it will write atomically. I think we need to be careful here because atomic writes have a significant performance overhead in that they write the entire contents in one VSBuffer to disk at once and skip streaming.
For now I would suggest to really scope atomic: true only to those specific cases we wanted to fix, such as settings.
Steps:
open a file
make it dirty
notice how DiskFileSystemProvider.doWriteFileAtomic is triggered with the entire contents
I still think its not necessarily bad that backups use this scheme, in the end it is also user data. I just feel we need to limit where atomic writes apply, e.g. by having a static map of well known paths or files.
While testing medium size files, I found backing up dirty files can cause the UI to freeze as it's not streamed, the whole process is stuck at encoding the whole string. As you can see in the perf log below, the file saving (the right side many small blocks) is doing fine as it's chunk-by-chunk so it doesn't hurt the frame rate.
Activity
sandy081 commentedon Sep 13, 2023
I was not expecting this. Why is backups using this scheme? I believe backups are not part of user data.
bpasero commentedon Sep 13, 2023
Sandeep Somavarapu (@sandy081) yeah also came to my surprise to be honest. But maybe so that it works in web?
sandy081 commentedon Sep 13, 2023
yeah, that could be the reason. Is it possible not to use userdata scheme in desktop?
bpasero commentedon Sep 13, 2023
Sandeep Somavarapu (@sandy081) I guess so, but not sure about the implications? To use that scheme, came in from your change in 79c4f10#diff-606a69dffd023e82747f7c6e0bbf3226dae1ec9f6dda1eef1f586509d958ec7eR36
I still think its not necessarily bad that backups use this scheme, in the end it is also user data. I just feel we need to limit where atomic writes apply, e.g. by having a static map of well known paths or files.
rebornix commentedon Sep 14, 2023
While testing medium size files, I found backing up dirty files can cause the UI to freeze as it's not streamed, the whole process is stuck at encoding the whole string. As you can see in the perf log below, the file saving (the right side many small blocks) is doing fine as it's chunk-by-chunk so it doesn't hurt the frame rate.
fix #192970
sandy081 commentedon Sep 14, 2023
Scoped atomic write to following resources:
fix #192970 (#193128)