Skip to content

[Performance] Non-owning string type #687

Open
@jm4R

Description

@jm4R

Can we have a string type which doesn't make a deep copy? It could be a big performance boost when we serialize some big Data Transfer Object to json. For example:

    const std::string s = make_some_string();
    json::object res;
    res.emplace("value", json::string_ref(s.c_str())); // string_ref or any name you like
    // ...
    return json::serialize(res);

Rapidxml already has simillar distinction between owning and non-owning strings:
https://rapidjson.org/md_doc_tutorial.html#CreateString
https://rapidjson.org/structrapidjson_1_1_generic_string_ref.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeaturePerformanceRelated to optimization of space or size

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions