aboutsummaryrefslogtreecommitdiffstats
path: root/icebox
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2019-06-06 18:54:22 +0200
committerMichael Buesch <m@bues.ch>2019-06-08 16:12:07 +0200
commit5f49bea71ce6b5362d0d9e99dc5c4910b6943a82 (patch)
tree8a3a735b0ae2b1b99f66e2eedc3fd1fabb0dbab0 /icebox
parentfab366e81d3196108da6f342489b6829f979d1b1 (diff)
downloadicestorm-5f49bea71ce6b5362d0d9e99dc5c4910b6943a82.tar.gz
icestorm-5f49bea71ce6b5362d0d9e99dc5c4910b6943a82.tar.bz2
icestorm-5f49bea71ce6b5362d0d9e99dc5c4910b6943a82.zip
icebox: Use LRU cache for often called function tile_has_net()
Diffstat (limited to 'icebox')
-rw-r--r--icebox/icebox.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/icebox/icebox.py b/icebox/icebox.py
index a6852fc..6445699 100644
--- a/icebox/icebox.py
+++ b/icebox/icebox.py
@@ -16,7 +16,7 @@
#
import iceboxdb
-import re, sys
+import re, sys, functools
class iceconfig:
def __init__(self):
@@ -36,6 +36,7 @@ class iceconfig:
self.ram_data = dict()
self.extra_bits = set()
self.symbols = dict()
+ self.tile_has_net.cache_clear()
def setup_empty_384(self):
self.clear()
@@ -456,6 +457,7 @@ class iceconfig:
return self.tile_has_net(x, y, entry[2]) and self.tile_has_net(x, y, entry[3])
return True
+ @functools.lru_cache(maxsize=2**16)
def tile_has_net(self, x, y, netname):
if netname.startswith("logic_op_"):
if netname.startswith("logic_op_bot_"):