Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: A few code size optimizations #12616

Merged
merged 4 commits into from Feb 28, 2014
Merged

std: A few code size optimizations #12616

merged 4 commits into from Feb 28, 2014

Commits on Feb 28, 2014

  1. std: Add cfg(test) to UnsafeArc assertions

    This is a ubiquitous type in concurrent code, and the assertions are causing
    significant code bloat for simple operations such as reading the pointer
    (injecting a failure point, etc).
    
    I am testing executable sizes with no I/O implementations (everything stubbed
    out to return nothing), and this took the size of a libnative executable from
    328K to 207K (37% reduction in size), so I think that this is one assertion
    that's well worth configuring off for now.
    alexcrichton committed Feb 28, 2014
    Configuration menu
    Copy the full SHA
    d5aa795 View commit details
    Browse the repository at this point in the history
  2. std: Remove lots of allocations from log settings

    Most of these are unnecessary because we're only looking at static strings. This
    also moves to Vec in a few places instead of ~[T].
    
    This didn't end up getting much of a code size win (update_log_settings is the
    third largest function in the executables I'm looking at), but this seems like a
    generally nice improvement regardless.
    alexcrichton committed Feb 28, 2014
    Configuration menu
    Copy the full SHA
    d89074c View commit details
    Browse the repository at this point in the history
  3. std: Avoid using "{:?}" in format strings

    This removes all usage of Poly in format strings from libstd. This doesn't
    prevent more future strings from coming in, but it at least removes the ones for
    now.
    alexcrichton committed Feb 28, 2014
    Configuration menu
    Copy the full SHA
    79e6ab5 View commit details
    Browse the repository at this point in the history
  4. std: Flag run_fmt() as #[inline(always)]

    This function is a tiny wrapper that LLVM doesn't want to inline, and it ends up
    causing more bloat than necessary. The bloat is pretty small, but it's a win of
    at least 7k for small executables, and I imagine that the number goes up as
    there are more calls to fail!().
    alexcrichton committed Feb 28, 2014
    5 Configuration menu
    Copy the full SHA
    ddc1c21 View commit details
    Browse the repository at this point in the history