Skip to content

Commit

Permalink
Re-enable lookup cache
Browse files Browse the repository at this point in the history
  • Loading branch information
InnovativeInventor committed Feb 15, 2022
1 parent 0738872 commit fb5a961
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gerrychain/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def edge_indicies(self):
def degree(self, n):
return self.graph.degree(n)

# @functools.lru_cache(65536) # memory leak
@functools.lru_cache(65536)
def lookup(self, node, field):
return self.graph.nodes[node][field]

Expand All @@ -418,4 +418,4 @@ def pygraph_pop_lookup(self, field: str):
attrs = [0] * len(self.pygraph.node_indexes())
for node in self.pygraph.node_indexes():
attrs[node] = float(self.pygraph[node][field])
return attrs
return attrs

0 comments on commit fb5a961

Please sign in to comment.