icebox: Use LRU cache for often called function tile_has_net()

This commit is contained in:
Michael Buesch 2019-06-06 18:54:22 +02:00
parent fab366e81d
commit 5f49bea71c
1 changed files with 3 additions and 1 deletions

View File

@ -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_"):