I've a problem with exporting several very long std::string with Irrlichts XML-Writer. The strings can go up to 1,000,000 chars in size.
Exporting several of them takes 12 minutes for 1.9 MB resulting XML, which seems extremly slow.
The code looks like this:
- cpp Code: Select all
// create File
irr::io::IWriteFile* file = FileSystem->createAndWriteFile(_filename);
if (file)
{
// create XML-Writer
irr::io::IXMLWriter* xmlWriter = FileSystem->createXMLWriter(file);
xmlWriter->writeXMLHeader();
xmlWriter->writeElement(L"FraktalIterations");
for (unsigned int i = 0; i<Fraktal->FraktalIteration.size() ; i++)
xmlWriter->writeElement(L"Iteration",true,
L"Number",irr::core::stringw(i).c_str(),
L"String",irr::core::stringw(Fraktal->FraktalIteration.at(i).c_str()).c_str());
xmlWriter->writeClosingTag(L"FraktalIterations");
// close File
xmlWriter->drop();
file->drop();
}
As mentioned, the datatype for Fraktal->FraktalIteration.at(i) is std::string.
Maybe someone has an idea why it's so slow - is this the fault of the XML-Writer or something other?
How could I speed this up?
As a note: I don't think that the datatype conversion from std::string to (const wchar_t* ), which is done by irr::core::stringw(Fraktal->FraktalIteration.at(i).c_str()).c_str(), is the problem.
I tried the same thing without writing it to XML, and it was really fast.
Greetings,
Squarefox
