Skip to content

Commit

Permalink
50% perf gain
Browse files Browse the repository at this point in the history
  • Loading branch information
trolldbois committed Aug 5, 2015
1 parent 88790e5 commit a43ef56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion haystack/mappings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def __init__(self, mapping_list, _target, name):
# finish initialization
self._heap_finder = self._set_heap_finder()
self.__optim_get_mapping_for_address()
self.__optim_heaps = None

def _set_heap_finder(self):
"""set the IHeapFinder for that process memory."""
Expand Down Expand Up @@ -333,7 +334,12 @@ def get_heap(self):

def get_heaps(self):
"""Find heap type and returns _memory_handler with heaps"""
return self.get_heap_finder().get_heap_mappings()
if not self.__optim_heaps:
# optimize heaps
self.__optim_heaps = self.get_heap_finder().get_heap_mappings()
return self.__optim_heaps

return

def get_stack(self):
# FIXME wont work on windows.
Expand Down

0 comments on commit a43ef56

Please sign in to comment.