CalculiX ccx, cgx and zstd compression

I’d like to propose adding native zstd (Zstandard) compression support to both ccx and cgx.

Using standard gzip or uncompressed files can be slow or storage-heavy. Integrating zstd directly gives us much faster compression and decompression speeds with excellent compression ratios, making reading/writing data vastly more efficient without relying on external scripts or pipes.

I actually have a working version running on my setup. The compressed .frd.zst file opens directly in cgx with no noticeable performance drop, while the file size drops dramatically from 98 MB down to around 13 MB.

Proposed additions:

  • Native .zst file support for reading and writing in ccx and cgx (e.g., opening .frd.zst directly).

  • Options to adjust compression levels and multi-threading.

What do you think? Would you find native zstd support useful in your workflow?

Test version (Windows):

ccx -i job.inp -z

4 Likes

looks great feature, it’s useful to not fill up disk space for just results only.

btw, naming extension can shorten to simplify by *.frdz maybe.

1 Like

It could be argued that an frd file basically is a bunch of tables.
So, I wonder if sqlite would not be a better fit for frd files?

The same could be said for the output of cgx.

The input files for cgx and ccx should remain plain text.

2 Likes

How does zstd compression compare to uncompressed binary output? (binary output is smaller than ASCII as well, faster to read/write and ccx/cgx already support it natively)
Is there any performance penalty for large files? (several GB)

Yet my biggest concern is that any downstream postprocessing tool would not be able to natively read the compressed frd. So I currently think it would make more sense to compress/decompress the result files outside of ccx/cgx if necessary.

1 Like
  1. Compression test:

    [KB]
    ASCII frd 98001
    ASCII frd zstd (1-3) 13804
    bin frd 34363
    bin frd zstd (1-3) 12314
  2. Performance test:

ASCII frd (file 3.4GB) [s] ASCII ZSTD (file 569MB) [s]
1 3183 3113
2 3669 3082
3 3426 3907
4 3771 3979

The differences in timing most likely stem from Turbo Boost technology (AMD Ryzen 7700).

@xyont for me, the .frd.zst format is better (than .frdz) because I can manually add an .frd file to the archive (e.g., using Windows Explorer), and if cgx supports it, I can launch the file without any extra steps.

1 Like