Skip to content

Applying manual_clamp lint results in slower code #14959

Open
@Shnatsel

Description

@Shnatsel

Description

The manual_clamp lint nags me to replace .max(0).min(255) with .clamp(0,255) in image-webp crate, but doing that results in significantly slower code.

You can find the full details and the assembly comparison in the issue I opened on the rustc repo: rust-lang/rust#141915

The root cause of the slowdown is still being investigated.

We've put an #[allow] on the affected piece of code in image-web, but it would be nice to disable this lint by default so it wouldn't cause any further performance regressions across the ecosystem.

Version

I've reproduced the regression on rustc 1.75, 1.82 and 1.87

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-blockedStatus: marked as blocked ❌ on something else such as an RFC or other implementation work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions