algebra icon indicating copy to clipboard operation
algebra copied to clipboard

Inconsistent feature gate "curve" is annoying

Open jon-chuang opened this issue 4 years ago • 3 comments
trafficstars

We should standardise the use of the feature across all crates.

This is required for macro based compilation in cuda kernels.

jon-chuang avatar Dec 11 '20 07:12 jon-chuang

Agreed. Same applies to base_field and scalar_field. I'd suggest we follow the convention currently done in bls12_377 for example. That would mean feature gating:

  • base_field for fq
  • scalar_field for fr
  • curve for extension fields fqX (if any), as well as the full curves submodule (<Curve Family>Config as well as individual curve configs in different forms, type aliases etc., if any)
  • default = [ "curve" ]

mmagician avatar Mar 30 '23 07:03 mmagician

Are these features even required? If rustc produces multiple .o files within the crate, then linkers should remove the dead code, so these features only save build time.

At least objdump -t on files in ./target shows rustc placing symbols into into different files sometimes, but maybe codegen-units = 1 or whatever changes this.

Another more extreme option: split some field crates off from their curve crates. I doubt this is worth the effort.

burdges avatar Mar 30 '23 22:03 burdges

It's more for compile-time savings than for space savings. But I agree that we should be consistent about these feature flags throughout the repo, instead of having them only in one-off crates.

Pratyush avatar Mar 31 '23 16:03 Pratyush