Skip to content

Add LTO option and opt-level to reduce the package size #227

@alexhroom

Description

@alexhroom

Currently when running R CMD CHECK on a repository using extendr, it flags up a NOTE on package size:

 * checking installed package size ... NOTE
  installed size is  6.6Mb
  sub-directories of 1Mb or more:
    libs   6.2Mb

This libs directory refers to the directory where the compiled Rust code is stored as a .dll or .so file. Rust by default generates huge executables, and the size can be reduced to no longer create the issue by adding some compiler options (here added to Cargo.toml, as in PR #226 ):

[profile.release]
opt-level = 'z' 
lto = true

While this isn't generally an issue for extendr use, it is an issue for users who prefer/require their packages to be available on CRAN - R CMD CHECK is expected to return no errors, warnings or notes whatsoever. There are a couple choices I'd consider:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions