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

perf[venom]: add OrderedSet.last() #4236

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
with:
types: |
feat
perf
fix
chore
refactor
Expand Down
6 changes: 6 additions & 0 deletions vyper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def __repr__(self):
def __iter__(self):
return iter(self._data)

def __reversed__(self):
return reversed(self._data)

def __contains__(self, item):
return self._data.__contains__(item)

Expand All @@ -45,6 +48,9 @@ def __len__(self):
def first(self):
return next(iter(self))

def last(self):
return next(reversed(self))

def pop(self):
return self._data.popitem()[0]

Expand Down
3 changes: 1 addition & 2 deletions vyper/venom/venom_to_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,7 @@ def _generate_evm_for_instruction(
else:
# peek at next_liveness to find the next scheduled item,
# and optimistically swap with it
# TODO: implement OrderedSet.last()
next_scheduled = list(next_liveness)[-1]
next_scheduled = next_liveness.last()
self.swap_op(assembly, stack, next_scheduled)

return apply_line_numbers(inst, assembly)
Expand Down
Loading