Commit ad484e4c authored by Patrick Storz's avatar Patrick Storz 🦄

Inkscapestream: Incredible speed up for writing of strings

This tremendously speeds up saving long strings which previously
had to do "n!" lookups (where n is the number of chars) as
Glib::ustring::operator[] has to iterate over all preceding
unichars in each iteration to find the requested unichar.

A file with a CDATA section of ~1 MB saves in a few milliseconds now,
previously it didn't finish even after some minutes.

Fixed bugs:
  - https://bugs.launchpad.net/inkscape/+bug/1793877

(cherry picked from commit 07078f49)
parent 682ad0f1
......@@ -501,8 +501,9 @@ Writer &BasicWriter::writeChar(char ch)
*/
Writer &BasicWriter::writeUString(Glib::ustring &str)
{
for (int i=0; i< (int)str.size(); i++)
put(str[i]);
for (auto it = str.begin(); it != str.end(); it++) {
put(*it);
}
return *this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment