Skip to content

Optimize Int to String (Display) methods. #26310

Closed
@arthurprs

Description

@arthurprs

As of today rust uses a naive implementation for converting integers to decimal strings in _Int_ Debug/Display methods.

I propose adding an optimization for the most commonly used case, that is, printing as decimals.

I wrote a reasonably optimized version here. Further optimizations are possible but I tried to keep the code size small (which I think is important), it's a road of diminished gains.

This should be non measurable overall but might give us a minor speedup on _serde_ and _rustc_ serializers.

Should I adapt the code and file PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions