Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JLockerman/smolcache
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: JLockerman/smolcache
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: flat-storage
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 27, 2020

  1. Switch to a flat layout for Elements

    This commit switched the cache to using a flat layout for Elements;
    instead of storing the Elements in a linked list, it stores them in a
    slice, and stores indexes into the slice where it once stored pointers.
    This has two advantages:
    
      1. The resulting code is slightly smaller.
      2. It has better locality
    
    One issue the linked list version could have is that after extensive
    deletions and additions, the Elements could be scattered across memory.
    By storing the elements in slices, and reusing the slots when elements
    are removed, all the elements should remain close together.
    
    This strategy has the disadvantage in that it might make eviction
    slower; it depends on if the better locality or the number of elements
    to check is the dominant term.
    Joshua Lockerman committed Apr 27, 2020
    Configuration menu
    Copy the full SHA
    22d5b78 View commit details
    Browse the repository at this point in the history
  2. Have cache work for string values as well, and add documentation

    Besides adding more comments, this commit adds the ability to store
    string values within the cache. We do this by just adding a str_value
    to the Element struct; this doesn't take any additional space, since we
    needed to pad out that struct to be cache-aligned anyway.
    Joshua Lockerman committed Apr 27, 2020
    Configuration menu
    Copy the full SHA
    3144be2 View commit details
    Browse the repository at this point in the history
Loading