mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
807 stars 44 forks source link

feat: enable parallel feature for `cc` #104

Closed rumblefrog closed 1 year ago

rumblefrog commented 1 year ago

Enables parallel feature for cc

ogoffart commented 1 year ago

that said, what's the motivation to enable this feature? The cpp-build crate only build one file. I don't think this would have any impact, would it? Why is it not enabled in by default in cc?

rumblefrog commented 1 year ago

that said, what's the motivation to enable this feature? The cpp-build crate only build one file. I don't think this would have any impact, would it? Why is it not enabled in by default in cc?

cpp-build exposes cpp_build::Config, and I'm currently adding a list of additional cpp files to be compile with it via Config::file.

CC Parallel vs Non-Parallel compile_objects:

https://github.com/rust-lang/cc-rs/blob/cf0a78b8ba8d15301c6596b35842da38f62b2233/src/lib.rs#L1201

https://github.com/rust-lang/cc-rs/blob/cf0a78b8ba8d15301c6596b35842da38f62b2233/src/lib.rs#L1352

I'm uncertain why this is not enabled by default, but I could revise this PR to gate it behind a feature flag as well.

rumblefrog commented 1 year ago

I have gated the parallel feature of cc.

ogoffart commented 1 year ago

I'm currently adding a list of additional cpp files to be compile with it via Config::file.

Indeed, makes sense.

I have gated the parallel feature of cc.

Thanks, then we don't depend on that dependency if not needed.