Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance improvements #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions villoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ def print_state(out, boundaries, state):

known_stops = set()

todo = state
todo = {x.start():x for x in state}
while todo:

out.write('<div class="line" style="">\n')

done = []
done = set()

current = None
last = 0
Expand All @@ -310,15 +310,13 @@ def print_state(out, boundaries, state):
if current: # stops here.
known_stops.add(i)
current.gen_html(out, i - last)
done.append(current)
done.add(current)
last = i

current = None
for block in todo:
if block.start() == b:
current = block
break
else:
try:
current = todo[b]
except:
continue

if last != i:
Expand Down Expand Up @@ -349,7 +347,7 @@ def print_state(out, boundaries, state):

out.write('</div>\n')

todo = [x for x in todo if x not in done]
todo = {x.start():x for x in todo.values() if x not in done}

out.write('<div class="log">')

Expand Down