From 428e38abe4ee5d8f35a6188a937d57ebe3030b70 Mon Sep 17 00:00:00 2001 From: MicroSourceCode <78088142+MicroSourceCode@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:52:54 +0300 Subject: [PATCH] Speedup memorydump Replacing the m_pText->clear() function with the replace function, it works faster. Replace 2 appendText calls with one writeText call, speed up when outputting bytes greater than 512, writeText is faster. --- src/src/examinememorydlg.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/src/examinememorydlg.cpp b/src/src/examinememorydlg.cpp index 57fd218b66..b96780234a 100644 --- a/src/src/examinememorydlg.cpp +++ b/src/src/examinememorydlg.cpp @@ -64,7 +64,7 @@ void ExamineMemoryDlg::End() void ExamineMemoryDlg::Clear() { - m_pText->Clear(); + m_pText->Replace(0, m_pText->GetLastPosition(), ""); m_LastRowStartingAddress = 0; m_ByteCounter = 0; for (int i = 0; i < 67; ++i) @@ -118,13 +118,14 @@ void ExamineMemoryDlg::AddHexByte(const wxString& addr, const wxString& hexbyte) // flush every 16 bytes if (m_ByteCounter != 0 && m_ByteCounter % 16 == 0) - { + { + wxString resultStr; // filled 16 bytes window; append text and reset accumulator array if (m_ByteCounter != 16) // after the first line, - m_pText->AppendText(_T('\n')); // prepend a newline + resultStr.Append(_T('\n')); // prepend a newline m_LineText[23] = _T('|'); // put a "separator" in the middle (just to ease reading a bit) - - m_pText->AppendText(wxString::Format(_T("0x%" PRIx64 ": %.67s"), m_LastRowStartingAddress, m_LineText)); + resultStr.Append(wxString::Format(_T("0x%" PRIx64 ": %.67s"), m_LastRowStartingAddress, m_LineText)); + m_pText->WriteText(resultStr); for (int i = 0; i < 67; ++i) m_LineText[i] = _T(' '); // update starting address for next row every 16 bytes