Skip to content

Strings are not optimized as vector of characters #75618

Open
@bugadani

Description

This might be a long shot, but it would be really nice if Rust could do this. I'm working on an embedded application, where I draw some text. For a single symbol, I need to use a different font than I use to draw the rest of the text. Right now, Rust doesn't know that I use a single character and the binary contains all of the unnecessary text processing code to map that character to an index and to draw it.

It would be really cool if Rust could recognize that my string is a constant instead of a black box value.

I've reduced an example: https://rust.godbolt.org/z/GrnE79

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsA-strArea: str and String

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions