Compression
Compression reduces the physical memory that the volume data occupies. RAM FS compression is per region and standing: compressed is the resting state of the data, not a one-off pack step, and it remains compressed under read access.
When to use compression
Best suited for volumes holding compressible, not constantly rewritten data: source trees, logs, text and CSV, test databases, build output. For a small scratch volume well within available RAM, leave it Off to gain maximum speed.
Compression model
File storage is divided into 2 MB regions, each exists independently in one of three states: absent (a hole, zero space taken), an uncompressed extent, or a compressed blob. Transitions are per region, never whole file:
- Read. A compressed region is decoded into a buffer on demand to satisfy the read and left compressed, so the saving persists across reads. Read-mostly data retains its footprint regardless of how often it is accessed.
- Write. Writing uncompresses only the required region to an extent, so the write runs at full speed. The region is recompressed later once idle.
- Sweep. A background pass recompresses idle regions. Active data stays uncompressed and fast; idling data is reclaimed.
Incompressible data and holes
Pre-compressed content (video, images, archives) is detected per region on the first attempt and thereafter skipped, so a mixed volume compresses the compressible data like text, logs, code and databases, while leaving pre-compressed media untouched. All-zero regions are punched to holes and occupy no space.
Compression levels
- Off: no compression, no CPU cost. The default.
- Fast: LZ4, modest compression ratio, negligible overhead. A good first choice when enabling compression.
- Normal: LZ4HC, higher compression ratio, still light on CPU.
- Maximum: Zstandard, highest compression ratio, highest CPU demands. Best for “write once, read many” highly-compressible data.
The selected level affects new compressions only. It can be changed at any time; existing data is repacked as it becomes idle. The compression codec is recorded per blob, so mixed-codec files remain valid after a change of compression level.
Space usage
Compared to NTFS, RAM FS usage is evaluated differently. Its volume space is calculated as if all its contents were uncompressed, to ensure that there is always sufficient room for write operations with any stored data. This means that compression does not add volume capacity: a 16 GB volume will fill up after adding 16 GB of data to it regardless of compression. The benefit is in the reduction of physical memory use. Compressed data uses less RAM, thus freeing more memory for other processes and allowing to have a volume larger than the available RAM.
For each volume listed in the main application window, RAM FS shows its compression level and the RAM saved by that compression. The memory bar along the bottom of the window reflects the real footprint in the physical RAM.