zstd-rs icon indicating copy to clipboard operation
zstd-rs copied to clipboard

Long compile times

Open Snowiiii opened this issue 8 months ago • 3 comments

Hey, The compile time is very long, is there a way to fix this?, The README says that it already uses a pre build bindgen.rs, but this literally feels like building from source

Image

Snowiiii avatar Jul 08 '25 19:07 Snowiiii

Hi, and thanks for the report!

Even with the pre-generated bindgen, it is building the C library from source. You can look into the pkg-config feature to detect and link a separately-installed lib (for example the system lib).

The default behaviour is to build the C library using the cc crate, which applies the same "profile" (dev/release) as the rust side. So dev builds should result in faster C compilation time as well, and release builds in a slower one.

gyscos avatar Jul 08 '25 19:07 gyscos

Hi, and thanks for the report!

Even with the pre-generated bindgen, it is building the C library from source. You can look into the pkg-config feature to detect and link a separately-installed lib (for example the system lib).

The default behaviour is to build the C library using the cc crate, which applies the same "profile" (dev/release) as the rust side. So dev builds should result in faster C compilation time as well, and release builds in a slower one.

So, What options do we have ?

Snowiiii avatar Jul 08 '25 19:07 Snowiiii

Using the pkg-config feature can help reduce build time by not compiling the C library. Depending on what your system library offers, it might end up dynamically linking (for example, on archlinux, the zstd system lib is built without static linking support, so using pkg-config will dynamically link to libzstd.so). If that's not what you want, you may need to look into configuring pkg-config with your own build of libzstd.

gyscos avatar Jul 08 '25 21:07 gyscos