From 485d28298a6396b5c1105012e9b24ae832718f80 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 15 Nov 2020 13:12:07 +0100 Subject: [PATCH] LibDebug: Use StringBuilder in append_to_line_info() This avoids a lot of temporary allocations and speeds up launching UE on a large executable by quite a bit. --- Libraries/LibDebug/Dwarf/LineProgram.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Libraries/LibDebug/Dwarf/LineProgram.cpp index 5384e45449..be96238a18 100644 --- a/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -25,8 +25,8 @@ */ #include "LineProgram.h" - #include +#include //#define DWARF_DEBUG @@ -100,8 +100,12 @@ void LineProgram::append_to_line_info() return; String directory = m_source_directories[m_source_files[m_file_index].directory_index]; - String full_path = String::format("%s/%s", directory.characters(), m_source_files[m_file_index].name.characters()); - m_lines.append({ m_address, full_path, m_line }); + + StringBuilder full_path(directory.length() + m_source_files[m_file_index].name.length()); + full_path.append(directory); + full_path.append(m_source_files[m_file_index].name); + + m_lines.append({ m_address, full_path.to_string(), m_line }); } void LineProgram::reset_registers()