From d88d759a74f1b79cdd45b27f5c1c56cf2d0a472e Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 15 Sep 2010 08:33:30 +0000 Subject: 15-20% speed improvement when parsing DWARF. I used instruments to find the hotspots in our code when indexing the DWARF. A combination of using SmallVector to avoid collection allocations, using fixed form sizes when possible, and optimizing the hot loops contributed to the speedup. llvm-svn: 113961 --- lldb/source/Core/DataExtractor.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lldb/source/Core/DataExtractor.cpp') diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 5b3c1d38991..3840afa9d4b 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -471,6 +471,37 @@ DataExtractor::GetU16 (uint32_t *offset_ptr) const return val; } +uint16_t +DataExtractor::GetU16_unchecked (uint32_t *offset_ptr) const +{ + uint16_t val = (m_byte_order == eByteOrderHost) ? + ReadInt16 (m_start, *offset_ptr) : + ReadSwapInt16(m_start, *offset_ptr); + *offset_ptr += sizeof(val); + return val; +} + +uint32_t +DataExtractor::GetU32_unchecked (uint32_t *offset_ptr) const +{ + uint32_t val = (m_byte_order == eByteOrderHost) ? + ReadInt32 (m_start, *offset_ptr) : + ReadSwapInt32 (m_start, *offset_ptr); + *offset_ptr += sizeof(val); + return val; +} + +uint64_t +DataExtractor::GetU64_unchecked (uint32_t *offset_ptr) const +{ + uint64_t val = (m_byte_order == eByteOrderHost) ? + ReadInt64 (m_start, *offset_ptr) : + ReadSwapInt64 (m_start, *offset_ptr); + *offset_ptr += sizeof(val); + return val; +} + + //---------------------------------------------------------------------- // Extract "count" uint16_t values from the binary data and update // the offset pointed to by "offset_ptr". The extracted data is -- cgit v1.2.3