Skip to content

Worse perf with NonZero #142914

Open
Open
@hkBst

Description

@hkBst

In rust-lang/literal-escaper#15 I introduced NonZero into literal-escaper, but noticed perf regressions (on ARM).

On compiler explorer I noticed x86_64 asm differences that seem to indicate there may be a difference in inlining behavior: asm being generated without code differences in the surrounding code (does that not mean it is dead?). These can indeed be removed by uncommenting the commented #[inline] directives (top left pane). On arm, the changes are similar but more extensive and I can't tell whether extra function code is called or not.

Sprinkling the right #[inline] directives does remove the perf regressions on ARM. I haven't been able to do perf measurements on x86_64 yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchS-needs-infoStatus: The issue lacks details necessary to triage or act on it.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions