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

Avoid many cmt allocations. #50418

Merged
merged 1 commit into from
May 5, 2018
Merged

Avoid many cmt allocations. #50418

merged 1 commit into from
May 5, 2018

Commits on May 3, 2018

  1. Avoid many cmt allocations.

    `cmt` is a ref-counted wrapper around `cmt_` The use of refcounting
    keeps `cmt` handling simple, but a lot of `cmt` instances are very
    short-lived, and heap-allocating the short-lived ones takes up time.
    
    This patch changes things in the following ways.
    
    - Most of the functions that produced `cmt` instances now produce `cmt_`
      instances. The `Rc::new` calls that occurred within those functions
      now occur at their call sites (but only when necessary, which isn't
      that often).
    
    - Many of the functions that took `cmt` arguments now take `&cmt_`
      arguments. This includes all the methods in the `Delegate` trait.
    
    As a result, the vast majority of the heap allocations are avoided. In
    an extreme case, the number of calls to malloc in tuple-stress drops
    from 9.9M to 7.9M, a drop of 20%. And the compile times for many runs of
    coercions, deep-vector, and tuple-stress drop by 1--2%.
    nnethercote committed May 3, 2018
    Configuration menu
    Copy the full SHA
    7cf142f View commit details
    Browse the repository at this point in the history