Skip to content

Commit 48cf1ab

Browse files
committed
fixup! Apply memoization to getPhases; this provides a decent perf gain
1 parent 1ded2b9 commit 48cf1ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

html5lib/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ def moduleFactory(baseModule, *args, **kwargs):
113113

114114
def memoize(func):
115115
cache = {}
116+
116117
def wrapped(*args, **kwargs):
117118
key = (tuple(args), tuple(kwargs.items()))
118119
if key not in cache:
119120
cache[key] = func(*args, **kwargs)
120121
return cache[key]
122+
121123
return wrapped

0 commit comments

Comments
 (0)