File Compression setting does not apply to autosaves #115697

Open
opened 2023-12-02 03:32:46 +01:00 by The5 · 6 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 537.34

Blender Version
Broken: -
Worked: -

Short description of error
The Preferences/Save & Load/Compress Files setting has no effect on auto saves.
With huge files this causes significantly longer saving times and unnecessary strain on SSDs.

Exact steps for others to reproduce the error
Compare the size of your autosave against your normal save.

471d78cbe5c1ce2b66c7796674caca99.PNG

I crated a suggestion a year ago https://blender.community/c/rightclickselect/ql83/?sorting=hot

I am aware this can easily be seen as a feature request, but it really is more of an oversight isn't it?

  • It has a negative effect on workflow, performance and SSD life (e.g. 15gb vs 2gb compressed written every 5 minutes)
  • It is de-facto already implemented and seems more of an oversight its not used for autosaves

I tried to read trough the code and it seems the autosave just rolls with a default parameters

9c0bffcc89/source/blender/windowmanager/intern/wm_files.cc (L2115)

while the usersave uses user parameters

9c0bffcc89/source/blender/blenkernel/intern/blendfile.cc (L1237)

It also seems the undo system may not use compression, but I am absolutely not sure.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 537.34 **Blender Version** Broken: - Worked: - **Short description of error** The `Preferences/Save & Load/Compress Files` setting has no effect on auto saves. With huge files this causes significantly longer saving times and unnecessary strain on SSDs. **Exact steps for others to reproduce the error** Compare the size of your autosave against your normal save. ![471d78cbe5c1ce2b66c7796674caca99.PNG](/attachments/3d85dcc0-8832-4298-8e27-bb2917d19121) I crated a suggestion a year ago https://blender.community/c/rightclickselect/ql83/?sorting=hot I am aware this can easily be seen as a feature request, but it really is more of an oversight isn't it? * It has a negative effect on workflow, performance and SSD life (e.g. 15gb vs 2gb compressed written every 5 minutes) * It is de-facto already implemented and seems more of an oversight its not used for autosaves I tried to read trough the code and it seems the autosave just rolls with a default parameters https://github.com/blender/blender/blob/9c0bffcc89f174f160805de042b00ae7c201c40b/source/blender/windowmanager/intern/wm_files.cc#L2115 while the usersave uses user parameters https://github.com/blender/blender/blob/9c0bffcc89f174f160805de042b00ae7c201c40b/source/blender/blenkernel/intern/blendfile.cc#L1237 It also seems the undo system may not use compression, but I am absolutely not sure.
The5 added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-12-02 03:32:47 +01:00
Member

Hi, thanks for the report. I think it make sense to allow compressing auto-save files

Hi, thanks for the report. I think it make sense to allow compressing auto-save files
Pratik Borhade added
Module
User Interface
Status
Confirmed
Interest
Core
and removed
Status
Needs Triage
labels 2023-12-06 07:37:56 +01:00
Member

Going through current code, it seems use of compression userpref is not possible for auto-save files.
Though this can still be achieved if I don't use memfile step for writing the file. I have a fix which is likely illegal:

diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc
index 0d525cc3a28..09ac85b5919 100644
--- a/source/blender/windowmanager/intern/wm_files.cc
+++ b/source/blender/windowmanager/intern/wm_files.cc
@@ -2098,7 +2098,10 @@ static void wm_autosave_write(Main *bmain, wmWindowManager *wm)
   const bool use_memfile = (U.uiflag & USER_GLOBALUNDO) != 0;
   MemFile *memfile = use_memfile ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : nullptr;
   if (memfile != nullptr) {
-    BLO_memfile_write_file(memfile, filepath);
+    int fileflags;
+    BlendFileWriteParams params{};
+    SET_FLAG_FROM_TEST(fileflags, ((U.flag & USER_FILECOMPRESS) != 0), G_FILE_COMPRESS);
+    BLO_write_file(bmain, filepath, fileflags, &params, nullptr);
   }
   else {
     if (use_memfile) {
Going through current code, it seems use of `compression` userpref is not possible for auto-save files. Though this can still be achieved if I don't use memfile step for writing the file. I have a fix which is likely illegal: ```Diff diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 0d525cc3a28..09ac85b5919 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -2098,7 +2098,10 @@ static void wm_autosave_write(Main *bmain, wmWindowManager *wm) const bool use_memfile = (U.uiflag & USER_GLOBALUNDO) != 0; MemFile *memfile = use_memfile ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : nullptr; if (memfile != nullptr) { - BLO_memfile_write_file(memfile, filepath); + int fileflags; + BlendFileWriteParams params{}; + SET_FLAG_FROM_TEST(fileflags, ((U.flag & USER_FILECOMPRESS) != 0), G_FILE_COMPRESS); + BLO_write_file(bmain, filepath, fileflags, &params, nullptr); } else { if (use_memfile) { ```

This also applies to quit.blend, often causing gigabytes more writing even when you had already saved moments ago

This also applies to quit.blend, often causing gigabytes more writing even when you had already saved moments ago
Member

@mont29 , would you consider this a bug?

@mont29 , would you consider this a bug?
Bastien Montagne added
Type
Known Issue
and removed
Type
Report
labels 2024-02-27 13:50:59 +01:00

Would consider that as a known issue for now, enabling compression on autosave can also have bad effects on performances (depending on the situation)...

Would consider that as a known issue for now, enabling compression on autosave can also have bad effects on performances (depending on the situation)...

ZSTD does have an adaptive compression mode, where the compression level is adjusted to saturate disk usage, theoretically meaning no slower than uncompressed or even faster if the compression ratio is high. It might be worth looking into for autosaves or even normal saving too

ZSTD does have an adaptive compression mode, where the compression level is adjusted to saturate disk usage, theoretically meaning no slower than uncompressed or even faster if the compression ratio is high. It might be worth looking into for autosaves or even normal saving too
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115697
No description provided.