P
__PPS__
Hello,
I have a function that does some decoding (same as urldecode in php)
and it returns std::string
std::string urldecode(const char* in, std::size_t length);
so, this function parses input and constructes output char by char. I
tried to use all sorts of direct access to the buffer of std::string to
be returned but it's always slow. It appered that if I dynamically
allocate memory fill it with output, then create std::string from this
buffer of chars then delete this buffer and return this string is at
least 2 times faster than using std::string with reserved and resized
buffer and then accessing this string trough operator[]. (simple
appending using += <char> slows down thing even 10 times!)
Are there any ways I can make it work in a simple fast way without
recopying memory
Thanks
I have a function that does some decoding (same as urldecode in php)
and it returns std::string
std::string urldecode(const char* in, std::size_t length);
so, this function parses input and constructes output char by char. I
tried to use all sorts of direct access to the buffer of std::string to
be returned but it's always slow. It appered that if I dynamically
allocate memory fill it with output, then create std::string from this
buffer of chars then delete this buffer and return this string is at
least 2 times faster than using std::string with reserved and resized
buffer and then accessing this string trough operator[]. (simple
appending using += <char> slows down thing even 10 times!)
Are there any ways I can make it work in a simple fast way without
recopying memory
Thanks