Skip to content

Inline get_root_key #26

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

Merged
merged 2 commits into from
Sep 19, 2019
Merged

Conversation

nnethercote
Copy link
Contributor

This allows some sizeable wins in rustc:

inflate-check
        avg: -4.9%      min: -6.7%      max: 0.0%
keccak-check
        avg: -3.4%      min: -5.3%      max: 0.0%
cranelift-codegen-check
        avg: -0.6%      min: -1.0%      max: -0.0%
clap-rs-check
        avg: -0.3%      min: -0.8%      max: -0.0%
serde-check
        avg: -0.4%      min: -0.7%      max: 0.0%
deeply-nested-check
        avg: -0.4%      min: -0.5%      max: 0.0%
deep-vector-check
        avg: -0.4%      min: -0.5%      max: 0.0%
unify-linearly-check
        avg: -0.2%      min: -0.5%      max: -0.0%
wg-grammar-check
        avg: -0.3%      min: -0.4%      max: 0.0%
style-servo-check
        avg: -0.2%      min: -0.4%      max: 0.0%

r? @nikomatsakis

Presumably these are related to the 2018 edition.
Inlining this function (and `get_root_key`) wins 5% on some rustc
benchmarks.
@@ -508,11 +519,20 @@ where
/// Returns the current value for the given key. If the key has
/// been union'd, this will give the value from the current root.
pub fn probe_value<K1>(&mut self, id: K1) -> V
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn probe_value<K1>(&mut self, id: K1) -> V
pub fn probe_value(&mut self, id: impl Into<K>) -> V


// An always-inlined version of `probe_value`, for hot callsites.
#[inline(always)]
pub fn inlined_probe_value<K1>(&mut self, id: K1) -> V
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn inlined_probe_value<K1>(&mut self, id: K1) -> V
pub fn inlined_probe_value(&mut self, id: impl Into<K>) -> V

@nikomatsakis nikomatsakis merged commit 96e3e96 into rust-lang:master Sep 19, 2019
nikomatsakis added a commit to nikomatsakis/ena that referenced this pull request Sep 19, 2019
Landed PRs:

- Add `inline_probe_value` to the public API (PR rust-lang#26)
@nikomatsakis nikomatsakis mentioned this pull request Sep 19, 2019
@nnethercote nnethercote deleted the inline-get_root_key branch September 20, 2019 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants