From ee37f4c569fa17df9041678c04bdb44b3f1fd38a Mon Sep 17 00:00:00 2001 From: Anders Dellien Date: Mon, 24 Dec 2018 17:56:52 +0100 Subject: [PATCH] More efficient AbbrevDecl handling (#212) Create all the AbbrevDecl objects during parsing and later return references to them - this gives a small performance gain. --- elftools/dwarf/abbrevtable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elftools/dwarf/abbrevtable.py b/elftools/dwarf/abbrevtable.py index 36f6d2a..6d29d5c 100644 --- a/elftools/dwarf/abbrevtable.py +++ b/elftools/dwarf/abbrevtable.py @@ -33,7 +33,7 @@ class AbbrevTable(object): """ Get the AbbrevDecl for a given code. Raise KeyError if no declaration for this code exists. """ - return AbbrevDecl(code, self._abbrev_map[code]) + return self._abbrev_map[code] def _parse_abbrev_table(self): """ Parse the abbrev table from the stream @@ -49,7 +49,7 @@ class AbbrevTable(object): declaration = struct_parse( struct=self.structs.Dwarf_abbrev_declaration, stream=self.stream) - map[decl_code] = declaration + map[decl_code] = AbbrevDecl(decl_code, declaration) return map -- 2.30.2