Debugger: Optimize cpu_thread::dump_regs()

Reuse string buffer. Copies and reallocations are expensive with such large strings.
This commit is contained in:
Eladash 2022-06-22 12:00:06 +03:00 committed by Megamouse
parent 794cbd8708
commit 5e01ffdfd8
12 changed files with 35 additions and 41 deletions

View file

@ -161,8 +161,16 @@ void RSXDisAsm::Write(std::string_view str, s32 count, bool is_non_inc, u32 id)
{
case cpu_disasm_mode::interpreter:
{
last_opcode = count >= 0 ? fmt::format("[%08x] (%s%u)", dump_pc, is_non_inc ? "+" : "", count) :
fmt::format("[%08x] (x)", dump_pc);
last_opcode.clear();
if (count >= 0)
{
fmt::append(last_opcode, "[%08x] (%s%u)", dump_pc, is_non_inc ? "+" : "", count);
}
else
{
fmt::append(last_opcode, "[%08x] (x)", dump_pc);
}
auto& res = last_opcode;