From 5f49bea71ce6b5362d0d9e99dc5c4910b6943a82 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 6 Jun 2019 18:54:22 +0200 Subject: icebox: Use LRU cache for often called function tile_has_net() --- icebox/icebox.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'icebox/icebox.py') 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_"): -- cgit v1.2.3