rust-gmp icon indicating copy to clipboard operation
rust-gmp copied to clipboard

Fixes used by VDF

Open DemiMarie opened this issue 6 years ago • 2 comments

  • Make Mpz #[repr(transparent)]
  • Add #[inline] attributes
  • Delete trailing whitespace

DemiMarie avatar Dec 06 '18 16:12 DemiMarie

for example what's the benefit here of inlining

It allows cross-crate inlining without LTO.

IIUC, by default, an rlib will contain an optimized representation of the source code for generic functions but will only contain the compiled form of non-generic functions. The source representation is required for cross-crate inlining.

The #[inline] attribute tells the compiler to include the source representation in the rlib, and hints to LLVM that it should inline these function calls.

Since all of the annotated functions are small, inlining seems reasonable, especially cross crate.

Apologies for the drive-by comment.

cbarrick avatar Feb 15 '21 18:02 cbarrick

for example what's the benefit here of inlining

It allows cross-crate inlining without LTO.

IIUC, by default, an rlib will contain an optimized representation of the source code for generic functions but will only contain the compiled form of non-generic functions. The source representation is required for cross-crate inlining.

The #[inline] attribute tells the compiler to include the source representation in the rlib, and hints to LLVM that it should inline these function calls.

Since all of the annotated functions are small, inlining seems reasonable, especially cross crate.

Apologies for the drive-by comment.

Mad, thanks for the info man.

tcharding avatar Feb 16 '21 04:02 tcharding