Skip to content

To much String::clone()? #240

Open
Open
@matthiasbeyer

Description

@matthiasbeyer

In src/value.rs (https://github.com/mehcode/config-rs/blob/master/src/value.rs#L148) we clone() a String. That leads to a lot of String cloning when using this library.

Yesterday, I played around with cargo-flamegraph and cargo-bench a bit because of this. I am by no means an expert on how to do performance analysis and these kind of things, but from what I could see, String::clone() is not insignificant in the runtime cost of this crate.
Maybe, and I want to empathize this, maybe we could gain a lot from removing this one clone() call.

BUT the problem is, that it is not simple! I tried a bit, and using a &'a str in this place would basically put a lifetime on everything in the crate.
In some places, it is not even possible to have a lifetime... maybe I should have invested more time to gain some results,... I am not sure.

Maybe someone else has an idea, or is better with driving such analysis...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions