summaryrefslogtreecommitdiffstats
path: root/src/io/inkscapestream.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-09-22 21:29:49 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-09-22 22:54:24 +0000
commit07078f49b961b996153b0436dfac97871b475b02 (patch)
tree7f25e8ee5c9aecc2ece58525b6426a31b8b0edc3 /src/io/inkscapestream.cpp
parentFix a bug if shape is not defined in powerclip (diff)
downloadinkscape-07078f49b961b996153b0436dfac97871b475b02.tar.gz
inkscape-07078f49b961b996153b0436dfac97871b475b02.zip
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
Diffstat (limited to 'src/io/inkscapestream.cpp')
-rw-r--r--src/io/inkscapestream.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/io/inkscapestream.cpp b/src/io/inkscapestream.cpp
index dcfc662ca..3042ecff7 100644
--- a/src/io/inkscapestream.cpp
+++ b/src/io/inkscapestream.cpp
@@ -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;
}