I'm looking at optimizing an applications save performance - it is too slow
right now and causes too much of a freeze. We're using QXmlStreamWriter,
here's the implementation
<https://github.com/Mudlet/Mudlet/blob/development/src/XMLexport.cpp>.

Profiling suggests that Qt's write element / attribute method is too slow (
screenshot <https://imgur.com/a/UUVSp4I>, results attached). Is there
anything I can do it speed it up? I tried giving it a QBuffer instead of a
QFile, but the difference was marginal.

A lot of time seems to be spent resizing the buffer, and unfortunately
there doesn't seem to be a way to pre-set the QBuffer size to something
reasonable to begin with.

Anyone have tips?
"Function / Call Stack","CPU Time","Module","Function (Full)","Source File","Start Address"
"QIODevice::write","0.0399935","libQt5Core.so.5","QIODevice::write(char const*, long long)","[Unknown]","0x1ad360"
" func@0x310fe0","0.0399935","libQt5Core.so.5","func@0x310fe0","[Unknown]","0x310fe0"
"  func@0x3111b0 <- func@0x312d60 <- QXmlStreamWriter::writeStartElement <- QXmlStreamWriter::writeTextElement <- XMLexport::writeTrigger <- XMLexport::writeTrigger <- XMLexport::writeTrigger <- XMLexport::writeTrigger <- XMLexport::writeHost <- XMLexport::exportHost <- Host::saveProfile <- TLuaInterpreter::saveProfile <- lua_pcall <- TLuaInterpreter::call <- TAlias::execute <- TAlias::match <- AliasUnit::processDataStream <- Host::send <- TCommandLine::enterCommand <- TCommandLine::event <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- func@0x1b22b0 <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- QGuiApplicationPrivate::processKeyEvent <- QGuiApplicationPrivate::processWindowSystemEvent <- QWindowSystemInterface::sendWindowSystemEvents <- func@0xd8b70 <- QEventLoop::exec <- QCoreApplication::exec <- main <- __libc_start_main <- _start","0.0199958","libQt5Core.so.5","func@0x3111b0","[Unknown]","0x3111b0"
"  QXmlStreamWriter::writeAttribute <- XMLexport::writeAction <- XMLexport::writeAction <- XMLexport::writeAction <- XMLexport::writeHost <- XMLexport::exportHost <- Host::saveProfile <- TLuaInterpreter::saveProfile <- lua_pcall <- TLuaInterpreter::call <- TAlias::execute <- TAlias::match <- AliasUnit::processDataStream <- Host::send <- TCommandLine::enterCommand <- TCommandLine::event <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- func@0x1b22b0 <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- QGuiApplicationPrivate::processKeyEvent <- QGuiApplicationPrivate::processWindowSystemEvent <- QWindowSystemInterface::sendWindowSystemEvents <- func@0xd8b70 <- QEventLoop::exec <- QCoreApplication::exec <- main <- __libc_start_main <- _start","0.011999","libQt5Core.so.5","QXmlStreamWriter::writeAttribute(QString const&, QString const&)","[Unknown]","0x3115e0"
"  func@0x312d60 <- QXmlStreamWriter::writeStartElement <- QXmlStreamWriter::writeTextElement <- XMLexport::writeTrigger <- XMLexport::writeTrigger <- XMLexport::writeTrigger <- XMLexport::writeHost <- XMLexport::exportHost <- Host::saveProfile <- TLuaInterpreter::saveProfile <- lua_pcall <- TLuaInterpreter::call <- TAlias::execute <- TAlias::match <- AliasUnit::processDataStream <- Host::send <- TCommandLine::enterCommand <- TCommandLine::event <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- func@0x1b22b0 <- QApplicationPrivate::notify_helper <- QApplication::notify <- QCoreApplication::notifyInternal2 <- QGuiApplicationPrivate::processKeyEvent <- QGuiApplicationPrivate::processWindowSystemEvent <- QWindowSystemInterface::sendWindowSystemEvents <- func@0xd8b70 <- QEventLoop::exec <- QCoreApplication::exec <- main <- __libc_start_main <- _start","0.0079987","libQt5Core.so.5","func@0x312d60","[Unknown]","0x312d60"
"QBuffer::writeData","0.036005","libQt5Core.so.5","QBuffer::writeData(char const*, long long)","[Unknown]","0x18f650"
"QByteArray::resize","0.0279967","libQt5Core.so.5","QByteArray::resize(int)","[Unknown]","0xb02e0"
"__GI_","0.0200273","libc.so.6","long double __GI_(long, int, bool, char)","malloc.c","0x8fa00"
"__GI_","0.0160065","libc.so.6","float __GI_(long, int, bool, char)","malloc.c","0x8f3e0"
"__GI___libc_malloc","0.0120044","libc.so.6","__GI___libc_malloc","malloc.c","0x8eeb0"
"QByteArray::QByteArray","0.0120013","libQt5Core.so.5","QByteArray::QByteArray(int, Qt::Initialization)","[Unknown]","0xb0050"
"qCalculateGrowingBlockSize","0.0119998","libQt5Core.so.5","qCalculateGrowingBlockSize(unsigned long, unsigned long, unsigned long)","[Unknown]","0xaf6b0"
"operator==","0.0119998","libQt5Core.so.5","operator==(QString const&, QStringRef const&)","[Unknown]","0x12cbf0"
"xcb_wait_for_event","0.01","libxcb.so.1","xcb_wait_for_event","[Unknown]","0xd4f0"
"__memcpy_sse2_unaligned_erms","0.01","libc.so.6","__memcpy_sse2_unaligned_erms","memmove-vec-unaligned-erms.S","0xb2350"
"QMutex::lock","0.01","libQt5Core.so.5","QMutex::lock(void)","[Unknown]","0xa3930"
"XMLexport::writeTrigger","0.00800122","mudlet","XMLexport::writeTrigger(TTrigger*)","XMLexport.cpp","0x3c81e0"
"func@0x310cd0","0.00800097","libQt5Core.so.5","func@0x310cd0","[Unknown]","0x310cd0"
"__GI___strlen_sse2","0.00800066","libc.so.6","__GI___strlen_sse2","strlen.S","0xa8450"
"QArrayData::allocate","0.00799505","libQt5Core.so.5","QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>)","[Unknown]","0xad750"
"func@0x2da260","0.00799491","libQt5Core.so.5","func@0x2da260","[Unknown]","0x2da260"
"QString::resize","0.00797939","libQt5Core.so.5","QString::resize(int)","[Unknown]","0x120780"
"FT_Matrix_Multiply","0.00399347","libfreetype.so.6","FT_Matrix_Multiply","[Unknown]","0xd690"
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to