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 AccountID string conversion caching #4181

Closed
wants to merge 1 commit into from
Closed

Improve AccountID string conversion caching #4181

wants to merge 1 commit into from

Commits on Jul 26, 2022

  1. Improve AccountID string conversion caching:

    Caching the base58check encoded version of an `AccountID` has
    performance advantages, because because of the computationally
    heavy cost associated with the conversion, which requires the
    application of SHA-256 twice.
    
    This commit makes the cache significantly more efficient in terms
    of memory used: it eliminates the map, using a vector with a size
    that is determined by the configured size of the node, and a hash
    function to directly map any given `AccountID` to a specific slot
    in the cache; the eviction policy is simple: in case of collision
    the existing entry is removed and replaced with the new data.
    
    Previously, use of the cache was optional and required additional
    effort by the programmer. Now the cache is automatic and does not
    require any additional work or information.
    
    The new cache also utilizes a 64-way spinlock, to help reduce any
    contention that the pressure on the cache would impose.
    nbougalis committed Jul 26, 2022
    Configuration menu
    Copy the full SHA
    861c780 View commit details
    Browse the repository at this point in the history