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

Use Vec::with_capacity(1) in a couple of places. #50762

Closed
wants to merge 1 commit into from

Commits on May 16, 2018

  1. Use Vec::with_capacity(1) in a couple of places.

    Because Vec::new() + push() results in a capacity of 4, and these
    particular vectors almost never grow past a length of 1.
    
    This change reduces the number of bytes of heap allocation
    significantly. (For serde it's a 15% reduction for a debug build.) This
    didn't give noticeable speed-ups on my machine but it's a trivial change
    and certainly can't hurt.
    nnethercote committed May 16, 2018
    Configuration menu
    Copy the full SHA
    4123f80 View commit details
    Browse the repository at this point in the history