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

Rob Hitchens patch -1. Performance and readability. #1

Closed
wants to merge 3 commits into from

Commits on Feb 16, 2019

  1. Update TestBokkyPooBahsRedBlackTree_flattened.sol

    Removed some unnecessary crawling and redundant comparisons for gas optimization. 
    
    Added "exists()" and explicit checks to prevent duplicate keys. Replaced z,y,z variables with more descriptive labels to help prepare the rotation and fixup sections for an audit. Removed family-tree items (siblings, grandparents, uncle, etc.) because these are not used by the algo and are of little interest except for debugging (reduces complexity for audit). 
    
    This makes it more like a black box with a minimal surface. 
    
    Removed the counter because it can be safely externalized. A client app can track the count if it needs to. That squeezes a little more gas out if no one needs the count. 
    
    Set up minimalist event logs. The tree itself emits no event, for gas-optimization. A log is implemented at the library client level and reports only the coming and going of key/values which is sufficient to reconstruct an ordered list. This approach is consistent with a philosophy of emitting an event for every *important* state change. Logs could, arguably, be implemented inside the library to *force* log emissions but that could be too opinionated and would probably be redundant when clients emit application-level events. We could say the library itself emits no events but the client should, as shown in the example. 
    
    Hope it helps.
    rob-Hitchens authored Feb 16, 2019
    Configuration menu
    Copy the full SHA
    e8e7479 View commit details
    Browse the repository at this point in the history
  2. Update TestBokkyPooBahsRedBlackTree_flattened.sol

    n trees managed by a single contract
    rob-Hitchens authored Feb 16, 2019
    Configuration menu
    Copy the full SHA
    eed8888 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2019

  1. Merge pull request #1 from rob-Hitchens/rob-Hitchens-patch-1

    Update TestBokkyPooBahsRedBlackTree_flattened.sol
    rob-Hitchens authored Feb 17, 2019
    Configuration menu
    Copy the full SHA
    3ae31f2 View commit details
    Browse the repository at this point in the history