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

Improve readability #6

Closed
bokkypoobah opened this issue Feb 24, 2019 · 3 comments
Closed

Improve readability #6

bokkypoobah opened this issue Feb 24, 2019 · 3 comments

Comments

@bokkypoobah
Copy link
Owner

As suggested in #1

@bokkypoobah
Copy link
Owner Author

next(...)
  x -> target
  y -> cursor

prev(...)
  x -> target
  y -> cursor

insert(...)
  x -> probe
  y -> cursor
  z -> key

remove(...)
  x -> probe
  y -> cursor
  z -> key
  
rotateLeft(...)
  x -> key
  y -> cursor
  _parent -> keyParent
  yLeft -> cursorLeft

rotateRight(...)
  x -> key
  y -> cursor
  _parent -> keyParent
  yRight -> cursorRight

insertFixup(...)
  y -> cursor
  z -> key
  zParent -> keyParent

removeFixup(...)
  x -> key
  xParent -> keyParent
  w -> cursor

SENTINEL -> EMPTY

Add isEmpty()
Add getEmpty()

bokkypoobah added a commit that referenced this issue Feb 24, 2019
next(...), prev(...), insert(...), SENTINEL -> EMPTY, isEmpty(),
getEmpty()
bokkypoobah added a commit that referenced this issue Feb 24, 2019
@bokkypoobah
Copy link
Owner Author

Gas increased slightly for insert after part 2 remove(...), most likely due to part 1 changes in insert(...) with the exist(...) replacing the duplicate check

Gas Before:

minGasUsedInsert=68318
averageGasUsedInsert=112496.21875
maxGasUsedInsert=167842
minGasUsedRemove=30542
averageGasUsedRemove=80300.5
maxGasUsedRemove=190402

Gas After:

minGasUsedInsert=68891
averageGasUsedInsert=113027.78125
maxGasUsedInsert=168337
minGasUsedRemove=27458
averageGasUsedRemove=66072.125
maxGasUsedRemove=169772

bokkypoobah added a commit that referenced this issue Feb 24, 2019
rotateLeft(...), rotateRight
bokkypoobah added a commit that referenced this issue Feb 24, 2019
@bokkypoobah
Copy link
Owner Author

Gas Before:

minGasUsedInsert=68891
averageGasUsedInsert=113027.78125
maxGasUsedInsert=168337
minGasUsedRemove=27458
averageGasUsedRemove=66072.125
maxGasUsedRemove=169772

Gas After:

minGasUsedInsert=68891
averageGasUsedInsert=113027.78125
maxGasUsedInsert=168337
minGasUsedRemove=27375
averageGasUsedRemove=65965.78125
maxGasUsedRemove=169605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant