-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Constructor of std::string does not allow any moving. Instead, it always copies all data.
Except if pointer std::string is not used. However, that is used minorly in project.
This leads to too many unnecessary copying around data, which can be size of block (64mb).
Proposal, use custom class that will not be copying data, but moving it. Also, it will control number of owners and gets destructed when owners<=0
class Slice {
char* ptr;
uint64_t size;
atomic<int> owners;
}
Other way is to use std::shared_ptrstd::string
Solving this will do some improvement to performance